Linux batch files?

dirtboy

Diamond Member
Oct 9, 1999
6,745
1
81
I would like to automate backing up a comple directories. Normally I log in and tar the directories, then ftp them off the server and then delete the tar'd files.

What is the equivelent to MS-DOS batch files in Linux?:confused:

I plan to create two, one to tar the directories and then one to delete the tar'd files.
 

andri

Senior member
Aug 12, 2000
339
0
0
Shell scripts, and they are very powerful.
For example, one easy shell script to archive all files in a dir and send them to some other box:

Code:
#!/bin/sh

tar zcf /tmp/temp.tar.gz /mydir
scp /tmp/temp.tar.gz [email]backup@some.other.box[/email]:backups/yourbox-`date +%Y%m%d%H%M`

archives all files in /mydir, and sends that file using scp (from SSH) to some.other.box, under the name backups/yourbox-YEARMONTHDAYHOURMINUTE

:)