• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Request]Small script for linux

Status
Not open for further replies.
(oO (||||) (||||) Oo)
Loyal Member
Joined
Aug 6, 2009
Messages
2,132
Reaction score
429
Need small help. Basically script to zip folder to specific location with name "backup_%date%"

Save to folder: /extended/hdd2_1000/
Save this folder: /extended/hdd1_320/

Thanks :)
 
Last edited:
Master Summoner
Joined
Oct 9, 2008
Messages
572
Reaction score
14
jMerlin: I think by "script for linux" he means a bash script.

Here's one I wrote down quickly, nothing fancy but gets the job done.

Code:
#!/bin/bash

DIR_TO_TAR="/home/andreas/stuff"
TARGET="/home/andreas/backups"
TODAY=$(date +%d-%m-%y)
FILENAME="backup_$TODAY.tar"

cd $TARGET && tar -cvvf $FILENAME $DIR_TO_TAR

Remember to change the variables so they fit to your setup, save it, chmod it and run it.
 
(oO (||||) (||||) Oo)
Loyal Member
Joined
Aug 6, 2009
Messages
2,132
Reaction score
429
jMerlin: I think by "script for linux" he means a bash script.

Here's one I wrote down quickly, nothing fancy but gets the job done.

Code:
#!/bin/bash

DIR_TO_TAR="/home/andreas/stuff"
TARGET="/home/andreas/backups"
TODAY=$(date +%d-%m-%y)
FILENAME="backup_$TODAY.tar"

cd $TARGET && tar -cvvf $FILENAME $DIR_TO_TAR
Remember to change the variables so they fit to your setup, save it, chmod it and run it.


Thanks :)

Thumbs up for you :thumbup1:
 
(oO (||||) (||||) Oo)
Loyal Member
Joined
Aug 6, 2009
Messages
2,132
Reaction score
429
Or he could just use the tar command himself and RTFM (read the f'ing manpage).
;o

jMerlin no offense but you are being a weird nerd.

I am no linux but have to deal with it sometimes. All I asked for a script to pack folder with specific zip name with date.

I modified it and using it. Thanks to Mindblaster7

Opposite to you.

Thread closed...
 
Status
Not open for further replies.
Back
Top