{"id":19,"date":"2012-03-07T14:47:59","date_gmt":"2012-03-07T14:47:59","guid":{"rendered":"http:\/\/scunster.co.uk\/?p=19"},"modified":"2013-10-27T17:32:44","modified_gmt":"2013-10-27T17:32:44","slug":"cron-stuff","status":"publish","type":"post","link":"https:\/\/scunster.co.uk\/?p=19","title":{"rendered":"CRON commands, help, tips"},"content":{"rendered":"<p>Random tips and commands to make cron even more use-able and useful<!--more--><\/p>\n<p>At the terminal type the following to list the cron jobs schedulated for the current user<br \/>\n<code>crontab -l<\/code><\/p>\n<p>At the terminal type the following to edit the current usres crontab<br \/>\n<code>crontab -e<\/code><\/p>\n<p>Add the following to cron to stop the system emailing you notifications<br \/>\n<code>MAILTO=\"\"<\/code><\/p>\n<p>The five stars that set cron scheduling options are as follows:<br \/>\n<code>* * * * * = MINUTE - HOUR - DAY OF MONTH - MONTH - DAY OF WEEK<\/code><\/p>\n<p>Dump \/ backup a mysql database (in this case at 11:10pm every Monday)<br \/>\n<code>10 23 * * 1 mysqldump -XXX -pXXX DATABASE &gt; \/var\/www\/vhosts\/DOMAINNAME\/FOLDER\/DATABASE.sql<\/code><\/p>\n<p>Command to remove all text files from specific directory (in this case every week)<br \/>\n<code>@weekly find \/var\/www\/vhosts\/DOMAIN\/DIRECTORY -name \"*.txt\" | xargs rm<\/code><\/p>\n<p>Run script etc on reboot using cron. Instead of using ***** you can use the @reboot command.<br \/>\n<code>@reboot sleep 60;\/path\/to\/Script.sh<\/code><\/p>\n<p>Other simple commands that you can use instead of ***** are:<br \/>\n<code>@daily<\/code><br \/>\n<code>@midnight<\/code><br \/>\n<code>@weekly<\/code><br \/>\n<code>@monthly<\/code><br \/>\n<code>@yearly<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Random tips and commands to make cron even more use-able and useful<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[112,111,113,79,78],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-linux","tag-auto","tag-cron","tag-cronjob","tag-linux-2","tag-suse"],"_links":{"self":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":10,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":835,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/835"}],"wp:attachment":[{"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scunster.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}