Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save frankmanzhu/9bb01f82d04b88ae0e18447d611ed2be to your computer and use it in GitHub Desktop.
Save frankmanzhu/9bb01f82d04b88ae0e18447d611ed2be to your computer and use it in GitHub Desktop.
coreos commands
# For more commands: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
#### Workflow Example (for Etcd)
# Clear all of the logs (Be very careful running this)
# #sudo journalctl --vacuum-time=1seconds
# Inspect cloudinit.conf
cat /run/systemd/system/etcd2.service.d/20-cloudinit.conf
# Reload systemd if cloudinit changed
sudo systemctl daemon-reload
# Start the service
sudo systemctl start etcd2
# Stop the service
sudo systemctl stop etcd2
# Look at the logs
journalctl -u etcd2 --pager-end
#### Systemctl
# Man page: http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=systemctl
# This will start the service in the current session
sudo systemctl start service_name.service
# Enable a service to be started at boot time
sudo systemctl enable service_name.service
# To determine the status of a particular service
systemctl status service_name.service -l
# If you merely need to verify that a service is running
systemctl is-active service_name.service
# If you merely need to verify that a service is enabled
systemctl is-enabled service_name.service
# To display a list of all active system services
systemctl list-units --type=service
# Reload systemd, looking for new or changed units
sudo systemctl daemon-reload
# Show the environment variables for a process
systemctl show docker --property Environment
# Edit the systemd files
systemctl edit --full etcd
#### Journalctl
# Man page: http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=journalctl
# Show logs from current boot
journalctl -b
# View logs from previous boot
journalctl -b -1
# Jump to end of logs for a service
journalctl -u service_name.service --pager-end
# Follow the logs for the update-engine service
journalctl -u update-engine -f
#### CoreOS
# Group used and reboot strategy can be found here
/etc/coreos/update.conf
# Restart the update engine after any changes
systemctl restart update-engine.service
# To force an update
sudo update_engine_client -update
# Release information can be found here
cat /etc/os-release
# Cloud-init (oem-cloudinit.service) can be found here
/run/systemd/system
# Dropin units can be found here
/etc/systemd/system
# Cloud config can be found here
cat /usr/share/oem/cloud-config.yml
# Default systemd unit files
/usr/lib/systemd/system/
/usr/lib64/systemd/system/
## Users
# Generating a password for elroy
SALT=$(openssl rand -base64 16 | tr -d '+=' | head -c 16)
PASSWORD=$(openssl passwd -1 -salt ${SALT} super_secret_password)
echo $PASSWORD | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment