Auto load and save crontab


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Auto load and save crontab
# 1  
Auto load and save crontab

Hi all,

I am trying to simplify things for two people who will be taking over my role whilst i go on leave. In doing so, i wanted to find a way that upon login to unix, the crontab would be reloaddd and resaved.

I want to do this due to our IT dept taking the server down more often of late and therefore deactiving the cron from running. I feel it would be simplier for these people to just log in to the system to re establish the crontab rather than them having to edit and save it. They have no unix or vi knowledge and would also cut procedure down.

Thanks in advance for any possible assistance.
# 2  
Reload is just reading the file with crontab:
Code:
crontab cronfile

But if the service isnt availabe...
So what does you IT do? stop the service ? or remove all found cronfiles in /var/spool/cron/crontabs ? In which case you keep a copy in your home directory and reload as mentionned above, then to modify you modify your file with vi rather than crontab -e
then you can compare if what is scheduled matches what you have by comparizon with your original file etc... You could create an alias to load if you want...
# 3  
The crontab info remains but when the server gets rebooted, the crontab is no longer active and every time i must do a crontab -e and save it again.

I was looking for a way to include this in a .profile so that upon login it auto edits and saves again so it ensures it remains active.

I rather this approach for handing the task to people when im on keave as all i have to tell them do is to log in when the automated process i have created fails to ever run.

As to what out IT dept does...very good q...they tell the company what they will do rather than ask how they can help...the cron file location was locked off for viewing so i coulsnt access the folder.

Thanks for the info. I shall give the command you mentioned a whirl
# 4  
Quote:
The crontab info remains but when the server
gets rebooted, the crontab is no longer active
and every time i must do a crontab -e and save it again.
I'm skeptical about that. Before taking any other action, I would make 100% sure that is really happening.
# 5  
I know it ceases to re activate as i have had many times where my process fell over because they took the server down and, when it came back up, my crontab just never executed at the times it was meant to. These times were well after their taking down of the server.
# 6  
Quote:
I know it ceases to re activate
All right. Well, here's an idea. Try putting in the .profile the following:
Code:
crontab -l > $HOME/crontab.save # save crontab
crontab      $HOME/crontab.save # install new crontab

On my linux computer, that reinstalls the crontab. No change to the file contents. But the timestamp on the crontab file under /var/spool/cron/crontabs is changed to the current time.

There is also "crontab -r" to remove the crontab that you could put in between the two lines above, if needed as another attempt to make cron read the crontab in your unusual situation.
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #622
Difficulty: Medium
In Python, you cannot have an else clause for the while loop.
True or False?

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies

2. Ubuntu

How to save crontab?

How to save crontab? I have try both method below but can't save it. FIRST METHOD error message hit 'escape' and then the following: :wq http://i.imgur.com/nY2YI.jpg SECOND METHOD error message ctrl + s http://i.imgur.com/ECzl0.jpg (3 Replies)
Discussion started by: mampwamp
3 Replies

3. Linux

How to save crontab configuration when using SSH?

Hi, I'm trying to save a crontab configuration using SSH, acessing a Linux machine from a Windows desktop. So, in the prompt I type "crontab -e", to edit crontab, and a window is opened. But after writing the changes, I press Save button but it seems not working, because when... (1 Reply)
Discussion started by: Roger75
1 Replies

4. UNIX for Dummies Questions & Answers

can't save crontab with vi

I edit crontab with vi editor, i delete the lines i wanted, but i can't save! i tried the :w, :wq, ZZ commands and it seems like vi is unfamiliar with it. any suggestions? (3 Replies)
Discussion started by: idan_cn
3 Replies

5. Shell Programming and Scripting

how to save crontab

how does one save changes in crontab? i am using vi editor. Issued crontab -e command on the prompt. however not sure how to save changes. :wq doesnt work. any idea.... (10 Replies)
Discussion started by: shahab03
10 Replies

6. Shell Programming and Scripting

Need help in wrting Load Script for a Load-Resume type of load.

hi all need your help. I am wrting a script that will load data into the table. then on another load will append the data into the existing table. Regards Ankit (1 Reply)
Discussion started by: ankitgupta
1 Replies

7. UNIX for Dummies Questions & Answers

Crontab refuses to save changes!

I'm trying to create a new crontab entry for a user on a debian box but whenever I do a crontab -e or crontab -u username -e then edit the crontab (with vim as my default editor) and :wq. I get the error message: no crontab for username - using an empty one crontab: no changes made to crontab... (18 Replies)
Discussion started by: fire>ant>
18 Replies

8. Programming

how to auto load a dynamic library

hi, every body. i have in trouble that how to load a dynamic library by hand. for example, i know how to generate a dynamic library and how to link a dynamic library in makefile. generate a dynamic library: add -dy -G behind cc link a dynamic library in makefile: add -dy -Bdynamic behind cc... (0 Replies)
Discussion started by: subrain
0 Replies

Featured Tech Videos