我有這樣一個systemd服務腳本:systemd自定義命令服務
#
# systemd unit file for Debian
#
# Put this in /lib/systemd/system
# Run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#
[Unit]
Description=sidekiq
# start sidekiq only once the network, logging subsystems are available
After=syslog.target network.target
[Service]
Type=simple
WorkingDirectory=/home/deploy/app
User=deploy
Group=deploy
UMask=0002
ExecStart=/bin/bash -lc "bundle exec sidekiq -e ${environment} -C config/sidekiq.yml -L log/sidekiq.log -P /tmp/sidekiq.pid"
ExecStop=/bin/bash -lc "bundle exec sidekiqctl stop /tmp/sidekiq.pid"
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target
現在我可以發出如下命令:
sudo systemctl enable sidekiq
sudo systemctl start sidekiq
我想創建另一個自定義命令,利用我可以相當sidekiq工人,安靜sidekiq我不得不USR1信號發送到這個過程中,這樣的事情:
sudo kill -s USR1 `cat #{sidekiq_pid}`
我想這樣做,使用systemd服務,所以基本上像
sudo systemctl queit sidekiq
命令有沒有一種方法來創建systemd服務文件自定義命令?如果是的話,那麼怎麼去做呢?
感謝Mike和謝謝創建sidekiq,我們剛剛在幾天前購買了專業版。有沒有辦法創建一個自定義命令呢?如果不止一個人在項目上工作,執行重新加載會令人困惑 – rajat
這是一個系統問題 - 我不相信systemd允許自定義動詞,如'systemctl quiet sidekiq',但我建議你做更多的研究,而不是採取我的話。 –