Centos 7 code:
CRON JOB in /etc/crontab
*/3 * * * * root sudo /opt/startifdown.sh >/dev/null 2>&1
/opt/startifdown.sh
#!/bin/sh ps -ef | grep transmission-daemon |grep -v grep > /dev/null if [ $? != 0 ] then sudo /bin/systemctl restart transmission-daemon.service > /dev/null echo Done else echo Running fi
then
Centos 6 code:
CRON JOB in /etc/crontab
*/3 * * * * root bash /opt/startifdown.sh >/dev/null 2>&1
/opt/startifdown.sh
#!/bin/sh ps -ef | grep transmission-daemon |grep -v grep > /dev/null if [ $? != 0 ] then service transmission-daemon restart > /dev/null echo Done else echo Running fi #
IMPORTANT:
Open your shell file with NotePad++
Click on Edit on Top bar menu, then choose EOL Conversion —> Unix(LF)