sharkbot221984
asked on
help with cron job and mysql export
Hi I have a series of tasks I need to perform to A: export data form a table to a csv file, B: strip the header of the file out, C: copy the file via SSH to another (linux) server.
I know all the commands and can complete all these task on their own from bash, but I want to string them together and be able to schedule a one time (as needed) cron job to execute each task in succession as these tasks need to be done over night.
The commands I use are:
A: mysql -u root -p --quick databasename -e "select * from tablename" | sed 's/\t/;/g' > file.csv
B: tail -n +2 file.csv > file_noheader.csv
C: rsync -e ssh -av file_noheader root@server:/path/file_noh eader.csv
I know all the commands and can complete all these task on their own from bash, but I want to string them together and be able to schedule a one time (as needed) cron job to execute each task in succession as these tasks need to be done over night.
The commands I use are:
A: mysql -u root -p --quick databasename -e "select * from tablename" | sed 's/\t/;/g' > file.csv
B: tail -n +2 file.csv > file_noheader.csv
C: rsync -e ssh -av file_noheader root@server:/path/file_noh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.