Skip to content

Commit

Permalink
Merge pull request ovh#32 in STICKY/overthebox-feeds from fix_crontab…
Browse files Browse the repository at this point in the history
… to release/53

* commit 'd59f5183d3c6ea8e61a88ba2ef1755574385d9d7':
  check if overthebox deamon is running and fix postinstall script
  • Loading branch information
simon committed Nov 12, 2015
2 parents 43adaff + d59f518 commit 680c5d2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion overthebox/defaults/crontab.defaults
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
#!/bin/sh

FILE="/etc/crontabs/root"

CMD="/usr/bin/overthebox_download_recovery"
if [ "$(grep "$CMD" $FILE -c )" != "1" ]
then
TMP=$(mktemp)
# cleanup
grep -v "$CMD" $FILE > $TMP
# fix
echo '00 02 * * 0 { /bin/sleep $(( $(tr -cd 0-9 </dev/urandom | head -c 3) * 7 )) && /usr/bin/overthebox_download_recovery; } &>/dev/null' >>$TMP
mv $TMP $FILE
fi

CMD="/usr/bin/overtheboxd"
if [ "$(grep "$CMD" $FILE -c )" != "1" ]
then
TMP=$(mktemp)
# cleanup
grep -v "$CMD" $FILE > $TMP
# fix
echo '00 */2 * * * { pgrep -f "lua /usr/bin/overtheboxd" 2>&1 1>/dev/null || /etc/init.d/overtheboxd restart; } &>/dev/null' >>$TMP
mv $TMP $FILE
fi

echo '00 02 * * 0 { /bin/sleep $(( $(tr -cd 0-9 </dev/urandom | head -c 3) * 7 )) && /usr/bin/overthebox_download_recovery; } &>/dev/null' >> /etc/crontabs/root
chmod 600 /etc/crontabs/root
chown root:root /etc/crontabs/root

Expand Down

0 comments on commit 680c5d2

Please sign in to comment.