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

Does anyone know how to get perl to work with cron on Solaris?

Replies are listed 'Best First'.
Re: Perl with Cron on Solaris
by ZZamboni (Curate) on Jun 27, 2000 at 18:37 UTC
    I have a good deal of perl programs run from crontab. The only special treatment I have needed in some cases is properly setting the PERLLIB or PERL5LIB environment variables. In those cases, because crontab entries are usually executed using /bin/sh, you can do something like this:
    0,30 * * * * PERLLIB=path1:path2 /your/perl/program.pl

    --ZZamboni

Re: Perl with Cron on Solaris
by swiftone (Curate) on Jun 27, 2000 at 19:41 UTC
    Be careful that your programs have a fully specified path on their magic line (e.g. #!/usr/local/bin/perl )

    while a line like (#!perl) will run for most users (since they have the required PATH in their environment), but it will have problems when demons try to run it, because they usually have a minimal environment.

    Also, does the userid that cron is running as have the proper permissions to your script and the perl interpreter?

Re: Perl with Cron on Solaris
by lhoward (Vicar) on Jun 27, 2000 at 18:31 UTC
    Do you want to call your perl program from cron? Or do you want to manipulate CRONTAB entries from perl?

    Running a perl program fron cron is just like running any other program from cron. You don't need to do anything special with cron to call a perl program.

RE: Perl with Cron on Solaris
by merlyn (Sage) on Jun 27, 2000 at 19:54 UTC
RE: Perl with Cron on Solaris
by csorensen (Beadle) on Jun 29, 2000 at 01:36 UTC
    what's the problem .. if you're not familiar with cron check out http://www.linuxdot.org/nlm/part1/cron.html
Re: Perl with Cron on Solaris
by ergowolf (Monk) on Jul 05, 2000 at 22:11 UTC
    Here is what I am trying to do in sh. I am familiar with cron. I just want script #1 to run from the command prompt and script #2 to run from cron. I will try ZZamboni's suggestion.
    Script #1 start the server and grab the process ID. nohup /local/silverstream/bin/SilverServer -nodbcheck & SIL=$! > Silverprocess echo $SIL bash-2.03# cat logger.sh kill -9 $SIL Script #2 kill the process and grab the log file mv log2 /local/home/admin/log2"`date|sed s/\ /_/g`" touch log2 chmod 644 log2 chown root log2 chgrp other log2

    Ergowolf
    Does code make a sound if no one is there to type it?