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

This needs a script to do whole things after that a crontab -l command can help you automate this script.

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

Thanks for your reply. Can you give me some assistance how to program the script?

Well I think it needs time I'll be back to you when it's tested from my side

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.