LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-28-2022, 11:05 PM   #1
John More
LQ Newbie
 
Registered: Oct 2022
Location: Canada - Kingston On
Distribution: Linux Mint 19.3 and later
Posts: 1

Rep: Reputation: 0
Systemd configuration to restart a program on failure and on system start up.


I am running a program on a remote server that I ssh into to update the program or configuration. I run the program in a TMUX window so I can disconnect and do other stuff on the server.
I would like to ensure the program restarts if it fails and if the server reboots. The program does create logs but I sometimes out to the console information I would like to continue to see after a restart.

I have tried a couple of experiments with Systemd configuration using a never ending bash script and then killing it.

I can't seem to determine if the script started again. Following is the systemd config file I am using

Quote:
[Unit]Description=testing resrtart functions
[Service]ExecStart=/home/john/dtest.sh
Restart=on-failure
RestartSec=10s
[Install]WantedBy=multi-user.target
Any help is definetly appreciated.
 
Old 10-30-2022, 11:58 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

you can check the status of units with systemctl and journalctl commands. Eg
Code:
systemctl status foo.service
journalctl -u foo.service
Evo2.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unkown cause for systemd failure state - systemd-logind cannot start org.freedesktop.systemd1 after server reboot mario.p Linux - Server 5 07-30-2018 02:11 AM
[SOLVED] samba needs a restart after a system restart dimm0k Slackware 16 12-04-2016 03:34 PM
[SOLVED] systemd unit does not load at startup. manual start shows no such file/dir failure zjmarlow Linux - Newbie 9 07-19-2015 06:19 AM
[SOLVED] Failure after failure after failure.....etc 69Rixter Linux - Laptop and Netbook 5 04-14-2015 09:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration