TheUndertaker has asked for the wisdom of the Perl Monks concerning the following question:

Hi, the host I am currently with does not support crontabs, and I was wondering is there anyway around this? i.e. every ½ hour or so, a file is executed automatically? Any ideas? Thanks, Matt

Replies are listed 'Best First'.
Re: Crontab Alternatives
by dws (Chancellor) on Feb 13, 2005 at 04:16 UTC

    Hi, the host I am currently with does not support crontabs, and I was wondering is there anyway around this?

    Have you given any thought to moving to a host that does support cron jobs?

    If you can run commands remotely on that host via ssh, you could set up a cron job on a home box to ssh into your ISP account an run a script.

      Well I'm not very proficient in these kinds of things... only recently started looking at them, and as such am now wondering whether or not there are any programs or utilities available I could upload to my site that could perform the same functions as cron jobs?

        [I] am now wondering whether or not there are any programs or utilities available I could upload to my site that could perform the same functions as cron jobs?

        Cron relies on a long-running scheduling service (the crond daemon process). To achieve the same effect, you would need to do something equivalent. If your ISP doesn't allow cron jobs, chances are good they they won't look kindly on your leaving a long-running, possibly detached process to achieve the same end.

Re: Crontab Alternatives
by saintmike (Vicar) on Feb 13, 2005 at 04:50 UTC
Re: Crontab Alternatives
by zentara (Cardinal) on Feb 13, 2005 at 13:54 UTC
    Well you could write your own daemon to sleep, then wake up and do things on an interval. Here is the simplest.
    #!/usr/bin/perl while(1) { sleep(60); @time = localtime(time); if(($time[2] == 10) && ($time[1] == 0) { #do what ever you want to do at 10am } }
    Now you have a couple of problems running this on a remote host. 1. You may have to daemonize it, ( see Proc::Daemon ) because once you log out, your program will need to be able to run in the background). 2. Your sysadmin may not like it. Maybe ask your sysadmin what he/she suggests? You may have the "at" command, instead of cron.

    Also check out Schedule::ByClock


    I'm not really a human, but I play one on earth. flash japh
websites with cronservices
by boboson (Monk) on Feb 13, 2005 at 11:23 UTC
Re: Crontab Alternatives
by Anonymous Monk on Feb 14, 2005 at 10:09 UTC
    If your host doesn't support crontab, it probably does so for a very good reason. Perhaps because you're paying minimal fees, so you get only basic service. Upgrade your service, or move to a host that does provide you with your needs. Trying to bypass cron will most likely not work out as expected, but certainly will bring the wrath of the hosts sysadmins upon you. My advice as a sysadmin is: don't.
Re: Crontab Alternatives
by submersible_toaster (Chaplain) on Feb 14, 2005 at 10:54 UTC

    Heed this very good Anonymous advice, unless you feel like loosing your site while provider waves the terms and conditions over your head, wrapped around a big stick, or worse a lawyer. Incurring the wrath of the sysadmin is really something to be avoided.


    I can't believe it's not psellchecked
Re: Crontab Alternatives
by hubb0r (Pilgrim) on Feb 14, 2005 at 04:10 UTC
    Have you tried to run 'at'? Do a man at to see what it does. It is basically a one time cronjob... ie. $ at 5:30 ./run_me_at_530.pl

    Perhaps each time your script runs it can re-at itself... run the same at command so that it will execute the next day. Not a very maintainable solution, but if it's one script, and they have the program available, it might be useful.