1753797 Members
7250 Online
108799 Solutions
New Discussion юеВ

HPUX at command

 
SOLVED
Go to solution
Shailesh Solanki
Occasional Contributor

HPUX at command

Hello All,

I am having some problems uaing the at command, the command I am using is the following:

banner hello 123 | mailx shailesh.solanki@email.com | at 1245

as soon as I hit enter the command runs, regardless of the time but the command

at -l
1216812600.a Wed Jul 23 12:45:00 2008

will show that the job still exists and is scheduled to run at 12:45, but then does not run at 12:45.

Does anyone have any ideas on what is happenning? and how I can stop the job running instantly.


Thanks

Shailesh Solanki




7 REPLIES 7
Hemmetter
Esteemed Contributor
Solution

Re: HPUX at command

Hi,

according to at(1):

use either:
$ at 1445
banner hello 123 | mailx shailesh.solanki@email.com
^d

or
$ at -f mail_a_banner.sh 1445



rgds
HGH
Dennis Handly
Acclaimed Contributor

Re: HPUX at command

As HGH says, you have the wrong format.
In fact, you should put your commands in a file to keep it simple.
What you have done is sent a banner to mailx and this gets mailed.
The output of mailx is then sent to at(1) to be done at 1245.

>will show that the job still exists and is scheduled to run at 12:45, but then does not run at 12:45.

Sure it does. Look inside the file /var/spool/cron/atjobs/ 1216812600.a to see what it is really doing.
OFC_EDM
Respected Contributor

Re: HPUX at command

banner hello 123 | mailx shailesh.solanki@email.com | at 1245

banner hello 123 is executed and the output is sent to mailx.

Mailx executes and the output of that command is then sent to the at command.

Which is why the email is sent immediately.

Try this:

echo "banner hello 123 | mailx shailesh.solanki@email.com" | at 1245

Then hopefully at 1245 the following command will be run :

banner hello 123 | mailx shailesh.solanki@email.com

You may want to put the full path to banner and mailx in the statement.

Don't have a system to test this right now...but I think it may work :)
The Devil is in the detail.
OldSchool
Honored Contributor

Re: HPUX at command

"banner hello 123 | mailx shailesh.solanki@email.com | at 1245"

think about what this says:

execute banner command, send the results to the pipe
execute mailx command using piped input and send the *output* of mailx to pipe (which isn't the email)

so the mail gets sent, and at 1245 "at" may try to run the "command" specified by the output of mailx...check the at-job itself to see for sure.
Shailesh Solanki
Occasional Contributor

Re: HPUX at command

Hello,

Thanks to Everyone who has replied, the best solution for me was the following

at -f /home/shailesh/123 1500

I had had to script what I needed to do but this worked best.

and all the other replies help me to understand what was happening.

Thanks

Shailesh
OFC_EDM
Respected Contributor

Re: HPUX at command

Got the chance to test. This works...but had to add -s to include a subject for the email. The command wouldn't work without it.


echo "/usr/bin/banner test | mailx -s 'test' my.account@aniceplacetowork.com" | at now
The Devil is in the detail.
Dennis Handly
Acclaimed Contributor

Re: HPUX at command

>Thanks to everyone who has replied,

If our answers were helpful, please read the following about assigning points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33
And about reopening threads:
http://forums.itrc.hp.com/service/forums/helptips.do?#41