Add TimeStamp to cron job and write file name sent
Hello,
I have written a cron job to automate the sftp of files using key authentication.
I wanted to add a timeStamp and name of file sent to a log file and append each these details to the same file each time files are sent and if possible include whether the files were sent successfully or not.
My ubuntu details:
Here is all the code i have so far:
cron job:
sftpTransfer.sh:
TimeStamp.sh:
My timestamp isn't working and doesn't output anything to a logFile although it did create the file.
How can I get the timeStamp to add to the logFile and also if possible the name of the file sent with the bool of successful or not?
Many thanks.
Moderator's Comments:
Please use CODE (not ICODE) tags as required by forum rules!
Last edited by RudiC; 02-23-2018 at 06:08 AM..
Reason: Changed ICODE to CODE tags.
Hi All,
i am trying to automate a process and have to create a unix script like wise. I have a scenario in which i need to automate a file movement. Below are the steps i need to automate.
1. Check whether a file (Not Fixed name-Pattern search of file say 'E*.dat') is present in a... (2 Replies)
Hello,
I have searched and searched google to do this and i want my websever to be able to run a php file everyday automatically. How do I go about doing this? Php is installed as an apache module not CGI.
Thank you! (3 Replies)
Dear all,
I have the following case,, i need to transfer a group of file from one server to another ....when the size of any of these file reach a specified value (Ex: 10MB) i need to transfer it to another server ....my problem is that i dont know how to determine when the size of the file... (1 Reply)
Hi,
I have following directory structure
Media (Inside media directory I have two folders namely videos and images)
-->videos
-->images
Inside media directory I have some video files with extension .mp4 and images with extension of .jpg and .jpeg
I want to write a cron job which will... (3 Replies)
Hi All,
I beginner in unix, i have no idea how to set the script file using cron job every 5 second. I also want to execute automatically the output to text file.This is my script name countsys.sh and my textfile abc.txt. (6 Replies)
Hi,
How to add a cron job in /etc/crontab using a shell script.??:confused:
Actually the requirement is we need to run a script say, XXX.sh every 10 min through “cron”.
That can be achieved by adding the below code line in the /etc/crontab , (i.e., “crontab -e ” command to add this to the... (4 Replies)
A well established form of application cron jobs look like this:
39 15 * * * && /usr/local/monitoring/oracle/check_dbs.sh >/dev/null 2>&1The repetition makes it a long line, hard to read, hard to maintain.
I suggest the following instead:
39 15 * * * { /usr/local/monitoring/oracle/check_dbs.sh... (1 Reply)
ofIn a big Unix environment you likely install cron jobs like this on a thousand systems:
39 15 * * * { /usr/local/monitoring/sendstats ; } >/dev/null 2>&1If all the system clocks are synchronized (usually via NTP), these jobs run *exactly* at the same time.
If the cron job accesses a shared... (2 Replies)
Hi all,
I'm having an issue with a script i wrote to pull information from the Amazon AWS API. Basically the script takes arguments from the command line and attempts to grab user information for each AWS access group. The command is issued like this:
# sh awsReport.sh <outputFileName>... (3 Replies)