transmission-daemon autostart if down

CRON JOB in /etc/crontab

*/1 * * * * root sudo /opt/startifdown.sh >/dev/null 2>&1

/opt/startifdown.sh

#!/bin/bash
#Scripts to start services if not running
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
#ps -ef | grep nginx |grep -v grep > /dev/null
#if [ $? != 0 ]
#then
#       /etc/init.d/nginx start > /dev/null
#fi
#ps -ef | grep php5-fpm |grep -v grep > /dev/null
#if [ $? != 0 ]
#then
#       /etc/init.d/php5-fpm start > /dev/null
#fi
#ps -ef | grep mysql |grep -v grep > /dev/null
#if [ $? != 0 ]
#then
#       /etc/init.d/mysql start > /dev/null 
#fi
Обновлено: 15/04/2022 — 16:41