September 2, 2019 parish Script to check if a Linux service is running… Sometimes my CrashPlan running on Linux will stop unexpectedly and you don’t know about it until there hasn’t been a backup for three days. 🙁 Here is a simple script that will check if your specified service is running and will start it if it’s stopped. You will have to replace “replace_me_with_a_valid_service” with the name of the service you want to check #!/bin/bash service=replace_me_with_a_valid_service if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 )) then echo "$service is running!!!" else /etc/init.d/$service start fi You can place it in crontab and have it executed automatically eg. to check every minute, insert into cron * * * * * /path/to/script with grateful thanks to http://www.akamaras.com/linux/linux-script-to-check-if-a-service-is-running-and-start-it-if-its-stopped/ The reason I run a Linux box to backup CrashPlan is that if you mount all the network attached storage devices in Linux, crashplan can back them up, so everything on my network is backed up on a single account. Just mount them in the fstab and ask crashplan to backup the /mnt folder! #Shares from Samba/Cifs/Windows Shares //192.168.0.120/Public/T /mnt/T cifs guest,uid=1000,iocharset=utf8 0 0 //192.168.0.112/www /mnt/Z cifs guest,uid=1000,iocharset=utf8 0 0 #Shares from NFS 192.168.0.148:/export/Music /mnt/Music nfs defaults 0 0 192.168.0.148:/export/Photos /mnt/Photos nfs defaults 0 0 192.168.0.148:/export/Movies /mnt/Movies nfs defaults 0 0 192.168.0.148:/export/Downloads /mnt/Software nfs defaults 0 0 By spr
Leave a Reply Cancel reply Δ This site uses Akismet to reduce spam. Learn how your comment data is processed.