Schedule a shell script without crontab every Wednesday at 10 AM


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Schedule a shell script without crontab every Wednesday at 10 AM
# 1  
Old 09-09-2018
Schedule a shell script without crontab every Wednesday at 10 AM

HI Guys


I need one shell script to be scheduled to run one shell script to be executed automatically every Wednesday at 10 AM Without crontab and "at" command..

Could you provide your suggestions ?


Thanks and Regards
kshitij Kulshreshtha

Last edited by vbe; 09-09-2018 at 04:45 PM..
# 2  
Old 09-09-2018
Q :
How do you think possible to execute anything at a given time/day/date without a scheduling utility?


cron or at are the only ones you will find on all systems, after you have solutions ($$$) provided by vendors...
# 3  
Old 09-09-2018
In addition to what vibe has already said, please also explain why you do not want to use the two utilities that are explicitly designed to do exactly what you want (i.e., at and cron).
# 4  
Old 09-09-2018
Normally these kinds of question indicate homework because these are the typical impractical questions you see in school.
# 5  
Old 09-10-2018
Well I have written this script , Not sure if it can be improved
I dont have root access

Code:
!/bin/csh


setenv next_week_w_old_time `date --d="next wed" +"%s"`
setenv curr_week_w_old_time `date +"%s"`

#setenv difference $(($next_week_w_old_time - $curr_week_w_old_time))
@ difference = $next_week_w_old_time - $curr_week_w_old_time
#echo $difference
sleep $difference
source shell_script


Last edited by Scott; 09-10-2018 at 06:52 AM.. Reason: Use CODE TAGS
# 6  
Old 09-10-2018
Quote:
Originally Posted by kshitij
Well I have written this script , Not sure if it can be improved
I dont have root access

Code:
!/bin/csh


setenv next_week_w_old_time `date --d="next wed" +"%s"`
setenv curr_week_w_old_time `date +"%s"`

#setenv difference $(($next_week_w_old_time - $curr_week_w_old_time))
@ difference = $next_week_w_old_time - $curr_week_w_old_time
#echo $difference
sleep $difference
source shell_script

What operating system are you using?

Is this script working the way you want it to work? I'm not aware of any system where the date utility has a --d option. Many systems have a date utility that doesn't even have a -d option. Does this script produce any diagnostic messages?

I don't see anything that is attempting to sleep until 10AM on Wednesday. And, if you start it before 10AM on a Wednesday, it would seem that your code might be trying to skip running on that day and instead try to wait for a week before running shell_script.

If the system is rebooted while your script is running, I don't see anything here that would attempt to restart it when the system comes back up to multi-user mode.

The cron, crontab, and at utilities are all designed to handle all of these issues. I repeat: Why do you want to reinvent the wheel when crontab and at are designed to handle all of the issues your current script seems to be lacking? Has your system's sys-admin decided that you should not be allowed to schedule jobs to run in the future by including your login name in the cron.deny file (if it is present) or by not including your login name in the cron.allow file (if it is present)?
These 2 Users Gave Thanks to Don Cragun For This Post:
# 7  
Old 09-10-2018
Just thought I'd add to what Don Cragun said. Your OS version may be deeply tied to script you are attempting to run. A few *nix version have csh as a default shell. Most these days will not even have csh installed by default. Or it may be installed somewhere other than /bin/csh, like /usr/bin/csh. You might want to run a `which csh` to ensure its installed and the correct path is being used.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to Schedule Shell Script on AIX

Hi All, I want to schedule a shell script on AIX. But Crontab is not working in my AIX Server.Is there any alternative? Please Suggest.. (2 Replies)
Discussion started by: bharat1211
2 Replies

2. Shell Programming and Scripting

Crontab schedule

Hi all, I would like to schedule a crontab script, which should run From 8pm Thursday to 2am Friday and it should run every 10 minutes. I have put a script like below, is it the correct one. 10 01,02,20,21,22,23,00 * * 4-5 /u01/app/test.ksh Any other options available to schedule the same... (6 Replies)
Discussion started by: sid2013
6 Replies

3. Shell Programming and Scripting

Schedule tasks in shell script

shell=ksh, How could I schedule tasks in shell script INSTEAD OF using the crontab -e functionality? For example, I want a script to print "Hello World" every 10 seconds (i.e., INTERVAL = 10s) until external termination signal is triggered. Thanks, (2 Replies)
Discussion started by: isaacniu
2 Replies

4. Shell Programming and Scripting

Shell script to schedule jobs

Dear all, I have to create a shell script which will run the job during weekday/weekend in following manner: - There are 3 jobs JB_1 JB_2 JB_3 These jobs changes its flag to "COMPLETED" in below 2 ways 1. These 3 jobs which runs after the completion of previous one i.e JB_1 runs and... (5 Replies)
Discussion started by: prajaktaraut
5 Replies

5. Shell Programming and Scripting

crontab: setup cronjob to run first wednesday of every month

Hi, How to setup cronjob to run first wednesday of every month. Is there a way? Thanks.. (9 Replies)
Discussion started by: Anjan1
9 Replies

6. Shell Programming and Scripting

How to schedule a script in crontab.

Hi, My script is in $home/bin/sample.sh. I want to run the script for 3times a day, first execution will be at 08:00 am. second execution will be at 16:00 pm third will be at 23:59 pm. what will be the entry with this requirement?? (1 Reply)
Discussion started by: shrima.pratima
1 Replies

7. UNIX for Advanced & Expert Users

Schedule a Crontab

All, I'm a newbie with crontab and I need your help with schedule a cold-backup running every Sunday at 7am except 1st of the month. Thank you so much. (2 Replies)
Discussion started by: hanie123
2 Replies

8. Shell Programming and Scripting

How to schedule my script without crontab

I have a script which shoud run after every 30 minutes.Though I know abt crontab, unfortunately I dont have access/authorization to use crontab in my terminal. Could any one pls let me know how to schedule the script without crontab ? Regards Prashant:) (3 Replies)
Discussion started by: prashant43
3 Replies

9. Shell Programming and Scripting

Schedule an interactive shell script

Hi, I need to schedule a shell script which executes another shell script along with a series of other commands. When the inner shell script is executed it prompts for a password..... This inner shell cannot be changed How can I do this???? Regards, Chaitrali. (4 Replies)
Discussion started by: Chaitrali
4 Replies

10. Shell Programming and Scripting

Cron to schedule 1st Wednesday of every Month??

Is there a way to use cron to run a job on the 1st Wednesday of every month?? The more generic question is, "Are all of the fields in crontab AND'd together or are some OR'd?". i.e. I had an entry in my crontab this morning as follows and I didn't expect it to run since the day of month is 20... (5 Replies)
Discussion started by: bradtri
5 Replies
Login or Register to Ask a Question