Sunday, 23 June 2013

Script to check whether dropbox (dropboxd daemon) is running in linux server using command line

Now a days more people are using dropbox for backup in linux servers. Dropbox is a great product which has their client in all major platforms. So this is really ideal for using in linux servers too.

Dropbox runs dropboxd daemon in the server to check for updates and syncing the contents between its clients across different platforms. Sometimes this daemon will get killed and our backup process will be in jeopardy.


This is a small script which will check whether the dropbox daemon is running in linux server and if not automatically start it. Add this script to cronjobs and you are set.

The script is given below:

Create a file named  /root/dropbox_checker.sh

vi  /root/dropbox_checker.sh

Add below script to it.

#!/bin/bash
if /usr/local/src/dropbox.py running && [ $? -eq 0 ]; then
/usr/local/src/dropbox.py start
else
echo "dropbox is already running"
fi


Add it to cronjobs.

crontab -e

0 * * * * sh /root/dropbox_checker.sh &> /dev/null

Now this will check whether the dropbox daemon is running in every hour and if not automatically start it.


No comments:

Post a Comment