- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using "at" to run a perl script (does'nt seem to w...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:13 AM
05-17-2004 05:13 AM
The script works fine if I just run it via ./pgm, but not when I run it as:
at -f /home/root/pgm now
I am using HP_UX 11.00 and perl v5.6.0
Does anyone know if I can run a perl script via the at command? I know it works via cron as I have scheduled several perl scripts using crontab.
Any assistance would be greatly appreciated.
jls
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:17 AM
05-17-2004 05:17 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
Make sure you have #!/opt/perl/bin/perl or what ever is the perl path at the start of the script.
Also make sure all required variables are defined and exported in script file.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:18 AM
05-17-2004 05:18 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
Make sure you use the full path names of any commands in your script.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:21 AM
05-17-2004 05:21 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
#!/usr/bin/perl -w
Almost all problems stem from the intentionally very sparse environment under which cron spawns new processes. You may also need to add -I arguments to tell Perl where to look for modules.
Probably the easist way to to let cron invoke a shell script which in turn sets and exports any needed enviroment variables like PATH and then let this shell script actually launch the Perl script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:27 AM
05-17-2004 05:27 AM
Solutionboth at and cron only take SHELL scripts, and disregard the header line, which is pretty counterintuative
Look at this:
--8<---
a5:/u/usr/merijn 111 > tty
/dev/ttyp2
a5:/u/usr/merijn 112 > cat xx.pl
#!/pro/bin/perl
use strict;
use warnings;
open STDOUT "> /dev/ttyp2";
print "Hello, world\n";
a5:/u/usr/merijn 113 > at -f xx.pl now
warning: commands will be executed using /usr/bin/sh
job 1084814691.a at Mon May 17 19:24:51 2004
a5:/u/usr/merijn 114 >
-->8---
look at the warning at gives!
The difference with cron is that you enter the executable perl script as a name in the cron line. The cron line is evaluated by /usr/bin/sh, and thusly nicely interprets the shebang line
Enjoy, Have FUN! H.Merijn [ leaving extending this knowledge to call perl in at to the user ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:31 AM
05-17-2004 05:31 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
--8<---
sh[55]: use: not found.
sh[56]: use: not found.
sh[58]: open: not found.
Hello, world
*************************************************
Cron: The previous message is the standard output
and standard error of one of your at commands.
-->8---
It prooves I'm right :)
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:40 AM
05-17-2004 05:40 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
I found that if I write a shell script that calls the perl script it works without error.
This is a pain, since the shell SHOULD interpret the shebang!
At any rate, I can get it to work properly even it is an ugly way to do it.
Thanks to all for quick responses.
jls
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:43 AM
05-17-2004 05:43 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
/tmp#cat test.pl
#!/opt/perl/bin/perl
$var=2;
$var+=2;
printf "$var\n";
/tmp#crontab -l
44 19 * * * /tmp/test.pl > /tmp/test.log 2>&1
/tmp#cat test.log
4
Seems that it works for me...
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2004 05:48 AM
05-17-2004 05:48 AM
Re: Using "at" to run a perl script (does'nt seem to work?)
Didn't saw the at/crontab problem. works with cron, don't with at.
You're absolutly right procura
Regards,
Fred
"Reality is just a point of view." (P. K. D.)