Help for scrpt .sh with cron.d

alex1972

New Member
Credits
30
Hello All

I wanted to know if someone could give me some advice on how to make this script work with cron.d. If the script is executed manually, it does not present any problems, however if I call it from cron.d it will not be executed.
----
#!/bin/bash
#!/bin/bash
SHELL=/bin/bash
CMENUPATH=/usr/vm/menus
PATH=/usr/vm/bin:/ipnpm:/sbin/e-smith:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/intertel/bin:/usr/j2se/bin:/usr/vm/bin:/ipnpm:/root/bin


(sleep 1; echo R; sleep 1; echo M; sleep 1; echo F; sleep 1; echo mailbox_dump; sleep 10; echo X; ) | /usr/vm/bin/console

sed -n '/MAILBOX: 421/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/421
sed -n '/MAILBOX: 422/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/422
sed -n '/MAILBOX: 423/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/423
sed -n '/MAILBOX: 424/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/424
sed -n '/MAILBOX: 425/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/425
sed -n '/MAILBOX: 426/,/MSGS/p' /home/messages/mailbox_dump | sed -n 2p > /home/messages/426
-----


in particular the command is not executed
(sleep 1; echo R; sleep 1; echo M; sleep 1; echo F; sleep 1; echo mailbox_dump; sleep 10; echo X; ) | /usr/vm/bin/console

which should generate a file mailbox_dump .

Running it with cron.d I get this error back by email

getenv_success
ser env varible CMENUPATH = / usr/ vm/ menus

but file is not generated

Any advice please?

Thanks Alessandro
 


TechnoJunky

Well-Known Member
Credits
304
When you execute the script manually, you're using your credentials. When you call the script, it's using other credentials. Make sure your file and directory rights have read and execute for other (775)
 

alex1972

New Member
Credits
30
When I run the script, I use the root credentials.
The credentials are correct because cron.d manages to execute the second part of the script in which it creates the 4xx file
 


Members online


Latest posts

Top