Create a cronjob


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Create a cronjob
# 1  
Old 11-02-2008
Question Create a cronjob

Hi,

unfortunately I don't have deep programming skills yet to create a little cronjob. It would be great if someone could help me with my little programm. How it should be programmed and correctly embedded to the cron daemon.

The programm should do the following:

1. Connect to a NFS share
2. If connection fails for several times, a mail should be sent to an admin
3. If connection succeeded look for two files with the pattern 'File1_*.XXX' and 'File1_*.YYY'
4. If both files are found move files to local system and append the actual system time to the files (in front of the file suffix)
5. Look in another directory for the file having the pattern 'File2_*' und rename it to'File2_YYYYMMDD_HHMMSS' with YYYYMMDD_HHMMSS being the timestamp from step 4
6. If there is more than one file with the pattern 'File2_*' send a mail to an admin and stop the program
7. Wait for a minute and remove the two files with pattern 'File3_*'. If there are not exactly two files with that pattern, send a mail to an admin

It is necessary that the job only runs once at a time.

It would be great if someone could help me along with my little program.

Thanks in advance!
Heinz
# 2  
Old 11-02-2008
This needs a script to do whole things after that a crontab -l command can help you automate this script.
# 3  
Old 11-02-2008
sorry, crontab -e will enable to to add your script like below

30 19 * * * /sfaqih/IN_Statistics/CGS

30 is the seconds and 19 is the hour so this script which is CGS will be run at 19:30
# 4  
Old 11-02-2008
Thanks for your reply. Can you give me some assistance how to program the script?
# 5  
Old 11-02-2008
Well I think it needs time I'll be back to you when it's tested from my side
# 6  
Old 11-02-2008
Thanks well. You don't have to write the whole script, a first draft would be absolutely enough so I can adapt it to my own needs.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cronjob

How to set cronjob for 48 hours. I can set for 2 days as shown below. * * */2 * * It is creating confusion for 30 days & 31 days per month. (3 Replies)
Discussion started by: Nishit
3 Replies

2. Shell Programming and Scripting

awk to create variables to pass into a bash loop to create a download link

I have created one file that contains all the necessary info in it to create a download link. In each of the lines /results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67... (8 Replies)
Discussion started by: cmccabe
8 Replies

3. UNIX for Dummies Questions & Answers

How to create a cronjob for the 3rd business day of every month?

Hello, Can you please help me out in creating a cronjob that runs every 3rd business day of the month. Thanks (2 Replies)
Discussion started by: AReddy
2 Replies

4. UNIX for Dummies Questions & Answers

Cronjob help

Hi I am very new to linux. I want to run a cronjob every 15 minutes that checks a directory for files. If the directory contains more than ten files I want it to send an email to me. All I have is this... */15 * * * * ls -l | wc -l | | mail -s "This is just a test" I would... (2 Replies)
Discussion started by: LinuxNewb
2 Replies

5. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

6. Shell Programming and Scripting

Cronjob

Hi, I'm totally new to shell scripting. I need help in my crontab script. I'm trying to read some values from user (username, log file directory, server) and then use those value to create a crontab for log rotation after some interval of time. creating crontabs manually isn't big deal.... (11 Replies)
Discussion started by: MisterKhan
11 Replies

7. Solaris

at vs cronjob

HI, What is the differnece between at / con job? thanks in advance. (1 Reply)
Discussion started by: mokkan
1 Replies

8. UNIX for Dummies Questions & Answers

cronjob

hi iam new at unix.iam running a cronjob,which i want to run on the first day of every month at 1AM.this is what i have specified: 00 01 1 * * is this corect? (1 Reply)
Discussion started by: wiz83
1 Replies

9. HP-UX

CronJob

Dear Guru, I have submitted some cronjobs that has been running for quite sometimes. However, today I counter some cronjob did not run. Can you please explain what causes this to happen. Any system setting that limit number of cronjob per minutes to be started, etc? Thanks. Kelly (1 Reply)
Discussion started by: hcng08
1 Replies

10. Shell Programming and Scripting

Cronjob

Please can someone help me. I need to set up a cron job to measure CPU usage, Disk I/O and memory usage over a period of 1 minute along with the number of users logged into the system. I also need to send it to another user besides myself every hour. Please can someone help me! Thanks. (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question