"at" command does not work propely in CentOS

Issues related to applications and software problems
Post Reply
nlp7
Posts: 3
Joined: 2017/03/24 19:43:58

"at" command does not work propely in CentOS

Post by nlp7 » 2017/03/24 19:49:22

I have two scripts:

script1.sh

Code: Select all

sleep 10
echo 'res1' > res1.txt
script2.sh

Code: Select all

sleep 10
echo 'res2' > res2.txt
Then I run:

Code: Select all

$ echo 'sh script1.sh' | at now
$ echo 'sh script2.sh' | at now
Expected behaviour (works in Ubuntu):
wait 10s, print res1, wait 10s, print res2.

What I get in CentOS:
wait 10s, print both res1 and res2.


Is this a bug?

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: "at" command does not work propely in CentOS

Post by TrevorH » 2017/03/24 21:46:39

Why are you expecting it to wait another 10s after the first? If you waited 10s after you entered the first at command then the 2nd would run 10s later.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

nlp7
Posts: 3
Joined: 2017/03/24 19:43:58

Re: "at" command does not work propely in CentOS

Post by nlp7 » 2017/03/25 18:55:47

The at commands are submitted within milliseconds. These are batch jobs that are coming from users. Each user submits a job to the queue, and the system should execute them one by one. Not all of them at the same time.


If I submit 1000 jobs now in Centos, it will spawn 1000 processes to run them now. This is not the purpose of a queue lol.

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: "at" command does not work propely in CentOS

Post by TrevorH » 2017/03/25 22:19:37

It's not a queue. You're telling it to run the command in 10s time and it does.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply