Rex::Commands::Cron - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation

NAMERex::Commands::Cron − Simple Cron Management

DESCRIPTIONWith this Module you can manage your cronjobs.

SYNOPSIS​ use Rex::Commands::Cron; ​ ​ cron add => "root", { ​ minute => '5', ​ hour => '*', ​ day_of_month => '*', ​ month => '*', ​ day_of_week => '*', ​ command => '/path/to/your/cronjob', ​ }; ​ ​ cron list => "root"; ​ ​ cron delete => "root", 3;

EXPORTED FUNCTIONS

cron_entry($name, %option)Manage cron entries. ​ cron_entry "reload−httpd", ​ ensure => "present", ​ command => "/etc/init.d/httpd restart", ​ minute => "1,5", ​ hour => "11,23", ​ month => "1,5", ​ day_of_week => "1,3", ​ day_of_month => "1,3,5", ​ user => "root", ​ on_change => sub { say "cron added"; }; ​ ​ # remove an entry ​ cron_entry "reload−httpd", ​ ensure => "absent", ​ command => "/etc/init.d/httpd restart", ​ minute => "1,5", ​ hour => "11,23", ​ month => "1,5", ​ day_of_week => "1,3", ​ day_of_month => "1,3,5", ​ user => "root", ​ on_change => sub { say "cron removed."; };

cron($action => $user, ...)With this function you can manage cronjobs. List cronjobs. ​ use Rex::Commands::Cron; ​ use Data::Dumper; ​ ​ task "listcron", "server1", sub { ​ my @crons = cron list => "root"; ​ print Dumper(\@crons); ​ }; Add a cronjob. This example will add a cronjob running on minute 1, 5, 19 and 40. Every hour and every day. ​ use Rex::Commands::Cron; ​ use Data::Dumper; ​ ​ task "addcron", "server1", sub { ​ cron add => "root", { ​ minute => "1,5,19,40", ​ command => '/path/to/your/cronjob', ​ }; ​ }; This example will add a cronjob running on the 1st, 3rd and 5th day of January and May, but only when it's a Monday or Wednesday. On those days, the job will run when the hour is 11 or 23, and the minute is 1 or 5 (in other words at 11:01, 11:05, 23:01 and 23:05). ​ task "addcron", "server1", sub { ​ cron add => "root", { ​ minute => "1,5", ​ hour => "11,23", ​ month => "1,5", ​ day_of_week => "1,3", ​ day_of_month => "1,3,5", ​ command => '/path/to/your/cronjob', ​ }; ​ }; Delete a cronjob. This example will delete the 4th cronjob. Counting starts with zero (0). ​ task "delcron", "server1", sub { ​ cron delete => "root", 3; ​ }; Managing Environment Variables inside cron. ​ task "mycron", "server1", sub { ​ cron env => user => add => { ​ MYVAR => "foo", ​ }; ​ ​ cron env => user => delete => $index; ​ cron env => user => delete => 1; ​ ​ cron env => user => "list"; ​ };
0
Johanes Gumabo
Data Size   :   12,125 byte
man-Rex::Commands::Cron.3pmBuild   :   2024-12-29, 07:25   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   4 / 256,706
Visitor ID   :     :  
Visitor IP   :   3.149.255.239   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|252|Rex::Commands::Cron.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Rex::Commands::Cron.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|252|Rex::Commands::Cron.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Rex::Commands::Cron.3pm|43|'br══─}─══ |'br══─}─══ )