Systemd

From Wasya Wiki
Revision as of 15:14, 17 January 2022 by Piousbox (Talk | contribs)

Jump to: navigation, search


they are in /etc/systemd/system/multi-user.target.wants

Read logs

sudo journalctl -u stockwatcher.service
journalctl -u nginx.service

Example service definition

[Unit]
Description=watch stocks

[Service]
Type=forking
WorkingDirectory=/home/ubuntu/projects/microsites3a/current
ExecStart=/home/ubuntu/.rbenv/shims/bundle exec rake ish_manager:stockwatcher
ExecStop=/bin/echo nothing
Restart=on-failure
Environment=RAILS_ENV=production
Environment=GMAIL_DOMAIN=gmail.com
Environment=GMAIL_USERNAME=<numeric-email>
Environment=GMAIL_PASSWORD=<password>

[Install]
WantedBy=multi-user.target