Advertisement
claviger-pc

airos-crond-install

Jul 17th, 2020
1,212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.01 KB | None | 0 0
  1. # run this on the command line of the ubiquiti device
  2. # cd /etc/persistent/; mkdir etc; mkdir etc/crontabs; wget -O cron-install.sh http://pastebin.com/raw/64X6hrvX; chmod +x ./cron-install.sh; ./cron-install.sh
  3. #
  4.  
  5. cat << EOF > rc.prestart
  6. #!/bin/sh
  7. #
  8. # /etc/persistent/rc.prestart
  9. #
  10. ## add crond to the start up list
  11. CROND=`grep crond /etc/startup.list | cut -d= -f2` if [ ${CROND} ]; then
  12.         :
  13. else
  14.         echo 'crond' >> /etc/startup.list fi
  15. # add crond to the /etc/sysinit directory
  16. if [ -e /etc/sysinit/crond.conf ];then
  17.         :
  18. else
  19.         cp /etc/persistent/etc/crond.conf /etc/sysinit/crond.conf fi
  20. # link /etc/crontabs to /etc/persistent/etc/crontabs
  21. if [ -e /etc/crontabs ]; then
  22.         :
  23. else
  24.         ln -s /etc/persistent/etc/crontabs /etc/crontabs fi
  25.  
  26. EOF
  27.  
  28.  
  29. cat << EOF > etc/crond.conf
  30. #!/bin/sh /etc/rc.common
  31. #
  32. # BusyBox v1.11.2 (2012-08-16 13:34:40 EEST) multi-call binary Usage: crond -fbS -l N -L LOGFILE -c DIR
  33. #    -f Foreground -b Background (default) -S Log to syslog (default) -l Set log level. 0 is the most verbose, default 8 -L Log to file -c Working dir
  34. #
  35. # ------------------ do not edit below this line ------------------
  36. plugin_start() {
  37.         /usr/bin/crond
  38.         true
  39. }
  40. plugin_stop() {
  41.         kill `pidof crond`
  42.         true
  43. }
  44. EOF
  45.  
  46.  
  47. cat << EOF > etc/crontabs/$USER
  48. #
  49. # /etc/persistent/etc/crontabs/ubnt This is the ubnt user's crontab
  50. #
  51. #         File Format field values +----------------------------------- minute 0-59
  52. # |    +------------------------------ hour 0-23
  53. # |    |    +------------------------- day of month 1-31
  54. # |    |    |    +-------------------- month 1-12
  55. # |    |    |    |    +--------------- weekday 0-6
  56. # |    |    |    |    |    +---------- command
  57. # |    |    |    |    |    |
  58. # */5  *    *    *    *    /do/something/here
  59.  
  60. EOF
  61.  
  62. save
  63. /usr/etc/init.d/plugin stop crond &&/usr/etc/init.d/plugin start crond
  64. chmod +x /etc/persistent/etc/rc.prestart
  65. cp /etc/persistent/etc/crontabs/ubnt /etc/persistent/etc/crontabs/$USER
  66. ./rc.prestart
  67. crontab -l
  68. ps | grep cron
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement