Solved at command can not run the shell script

spring_64

Member


Messages: 80

Hi all
When I run this code the shell script does not work.
sudo at -t 200201010102 -f /test.sh

The output of date command is:
Code:
Tue Jan  1 01:00:01 IRST 2002
The script is:
Code:
    #!/bin/sh
    shutdown -r now
The user that I run the at is test. I give the permission in sudoers file to the user test.
When I run the command it has no error. At the given time I execute atq and the job disappear correctly.

What is wrong?

Thanks
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,297
Messages: 29,745

Looks like the path to the script is incorrect, you're trying to start /test.sh, I very much doubt you have stored this script in the top root directory (/).

Also note that the date is in 2002, that's 16 years ago.
 
OP
OP
S

spring_64

Member


Messages: 80

yes, you're right. In the real code the path is different. It's /usr/local/etc/test.sh.
is it important what the date is?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,297
Messages: 29,745

is it important what the date is?
Yes, because it's rather pointless to schedule something in the past. Which is probably why the job disappeared, it should have ran 16 years ago.
 
OP
OP
S

spring_64

Member


Messages: 80

Thanks all,
I solve the problem by adding a user named "daemon:wheel" and mkdir -p /var/at/{jobs,spool} and chown -R daemon:wheel /var/at/
 
Top