let Perl work as crontab

You don’t have permission to schedule script in crontab? np, Let Perl help you.

Example:
#!/usr/bin/perl
die "usage: $0 command_to_run interval" unless 2==@ARGV;
while(1){
   eval{ system("$ARGV[0]");}; warn $@ if $@;
   sleep $ARGV[1];
}

Note: for more details, check eval and sleep usage with command "perldoc -f eval" and "perldoc -f sleep".

Advertisements

About Pang

Oracle DBA working in database, fusion middleware and identity management and cloud.
This entry was posted in Perl. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s