Systemd service for multics & scheduled restart of multics..

TüRKMaSTeR

Administrator
Yönetici
Ofline
Here is how to automatically restart a crashed multics process with systemd. (tested on ubuntu & debian)

- create a new systemd service
Kod:
sudo nano /etc/systemd/system/multics.service

- add the following content
Kod:
[Unit]
Description=Multics daemon
After=network.target
Requires=network.target

[Service]
Type=forking
ExecStart=/var/bin/multics -b -C /var/etc/multics.cfg
ExecStop=/bin/kill -9 $MAINPID
TimeoutStopSec=1
Restart=always
RestartSec=5
StartLimitInterval=0

[Install]
WantedBy=multi-user.target

- modify this line that matches your paths & bin & config name:
Kod:
ExecStart=/var/bin/multics -b -C /var/etc/multics.cfg

- once you’ve created the service, you need to reload the systemd daemons by issuing
Kod:
sudo systemctl daemon-reload

- start the multics by issuing
Kod:
sudo systemctl start multics

- to ensure multics starts on boot, to do that, issue the following command
Kod:
sudo systemctl enable multics.service

- to check multics is running by running the following command
Kod:
sudo systemctl status multics

If multics crashes it will start again automatically.

--

If you want to reboot a multics (service) than you can create a cron job

- add a cron job by editing crontab with following command
Kod:
sudo nano /etc/crontab

- let's say You want to restart multics at 3 AM every day, than add the following line:
Kod:
00 03 * * * root systemctl restart multics

or
Kod:
00 03 * * * root service multics restart

or
Kod:
00 03 * * * root killall -9 multics

- after editing and saving then you need to restart the crontab with:
Kod:
sudo service cron restart

That it's.

Now You have auto restart of multics proces after crash and reboot of multics at 3 AM at your VPS.
 
Üst