]>
Commit | Line | Data |
---|---|---|
1 | #! /bin/sh | |
2 | ||
3 | # Thales CRONTAB script | |
4 | # Written by Jollino <jollino@sogno.net> | |
5 | # Improved by Lucas <lucas@lucas-nussbaum.net> | |
6 | ||
7 | # CONFIGURATION | |
8 | ||
9 | thales_dir='/home/lucas/thales' | |
10 | # you might want to add the -v parameter to generate more output | |
11 | thales_exec='./thales' | |
12 | thales_pid='thales.pid' | |
13 | thales_log='thales.log' | |
14 | ||
15 | # SCRIPT | |
16 | ||
17 | cd $thales_dir | |
18 | if [ -f $thales_pid ]; then | |
19 | pid=`cat $thales_pid` | |
20 | if [ `ps -p $pid | wc -l` -eq 2 ]; then | |
21 | exit | |
22 | else | |
23 | echo "Pidfile was stale." | |
24 | fi | |
25 | fi | |
26 | ||
27 | echo "Looks like Thales died... let's relaunch it" | |
28 | backuplogname=$thales_log.`date '+%s'` | |
29 | mv $thales_log $backuplogname | |
30 | gzip $backuplogname | |
31 | $thales_exec |