cron command validation


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers cron command validation
# 1  
Old 03-04-2012
cron command validation

In cron tab, while scheduling any commands to be run in particular time, is there any level of validation being performed to identify whether the command to be executed is perfectly valid. But AFAIK, it's not being reported even if you schedule a non existing command .say
Code:
tea abc

, Where tea ia a non existing command. If you try to schedule the above, it's being scheduled. What i expect is it should report immediately that its not a valid command,
Actually is it a drawback of cron?

Thanks
# 2  
Old 03-04-2012
When you install a cron table, the table itself is validated (the correct number of fields in the time specification etc.), but there is no validation of the command, parameters or anything else on the command line. It is well beyond the scope of cron to try to enforce command syntax or that a command is valid.

Is this a limitation of cron? I'd have to say no. The burden of getting entries in the cron table correct is on the user.
# 3  
Old 03-04-2012
Is there any Way to validate the command entered in cron but without executing them actually ?
Thanks
# 4  
Old 03-05-2012
No real way to validate the command itself.
We sometimes do a basic check which means that we can suspend a process at will without changing the crontab.
Code:
* * * * * [ -x /path/scriptname ] && /path/scriptname

We also run a script daily to check the cron log for failed crons.

In the end there is no substitute for pre-production testing.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Command works at command line but not from cron

Oracle Linux 6. Trying to set up a simple monitoring of memory usage. This command does exactly what I want at the command line: echo $(date +%Y-%m-%d" "%H:%M:%S) $(grep PageTables /proc/meminfo) >> /home/oracle/meminfo.logBut when I put it in my crontab: * * * * * echo $(date +%Y-%m-%d"... (2 Replies)
Discussion started by: edstevens
2 Replies

2. UNIX for Dummies Questions & Answers

Cron the top command

Hi Greetings!!!!! I want to cron the top command 1 hour once and need to save the file in /home/dm. i am using redhat linux. (1 Reply)
Discussion started by: thangadurai
1 Replies

3. Solaris

passwd command validation

hi Actually the normal user as the permission of executing the passwd command due to suid program... eg consider the two users (normal user) as tom & jerry! when tom executes command as " passwd tom" no issue here... In the same way when the same user tom uses the command as "passwd jerry" ... (1 Reply)
Discussion started by: sriniv666
1 Replies

4. Shell Programming and Scripting

Command line user input validation

Hi guys, I have a piece of snippet below which asks the user to input some numbers if isDatasubEnabled && isReconEnabled; then echo "1 = CGT, 2 = Subscriber, 3 = Order Monitor, 4 = Revaluations, 5 = Reconciliation, 6 = All, 7 = Exit" elif isDatasubEnabled &&... (4 Replies)
Discussion started by: pyscho
4 Replies

5. UNIX for Dummies Questions & Answers

Need to run a command from cron

How can I run the following command from cron? tar -cvf /email_backup/email_bu_062110.tar /prod/email (2 Replies)
Discussion started by: nim73
2 Replies

6. SuSE

inconsistent ls command display at the command prompt & running as a cron job

Sir, I using the following commands in a file (part of a bigger script): #!/bin/bash cd /opt/oracle/bin ls -lt | tail -1 | awk '{print $6}' >> /tmp/ramb.out If I run this from the command prompt the result is: 2007-05-16 if I run it as a cron job then... (5 Replies)
Discussion started by: rajranibl
5 Replies

7. UNIX for Dummies Questions & Answers

Cron command for backups

Hello All, I am new to AIX. I come from a VAX/VMS background. I would like to find the backup procedure for my RS600. How can I see/modify an existing "cron" command that executes my nightly backup and sets the rights on files ? Thanks (2 Replies)
Discussion started by: gjarvis
2 Replies

8. Shell Programming and Scripting

Command line inputs validation

Hi, I have a script called read.sh that takes a file as input. Now I want to make that script take the file as input with a -f option preceding the filename. How can I do this validation. How can I find whether the given option is -f or not inside the script. Thanks in advance (2 Replies)
Discussion started by: sendhilmani123
2 Replies

9. UNIX for Dummies Questions & Answers

cron mv command?

I'm using this in cron: cd public_html/temp mv 2.php 1.php that command, from ssh, renames the file in the public_html/temp folder from 2.php to 1.php. For some reason it's not doing it via cron, though. Any idea why? Thanks for your time. (3 Replies)
Discussion started by: wolfyman
3 Replies

10. UNIX for Dummies Questions & Answers

cron command not found

I'm trying to execute a command in my crontab, but every hour I'm sent mail that says /bin/bash: root: command not found Does anyone know why I'm getting that message? It was in the crontab before I started screwing around with it and it was working fine. Now that I messed with it, ran a... (4 Replies)
Discussion started by: sstevens
4 Replies
Login or Register to Ask a Question