PDA

View Full Version : What have you automated with custom shell scripts?



kpkeerthi
September 11th, 2008, 02:12 PM
Post in a few sentences what tasks have you automated with custom shell scripts.

EDIT: Here is what I have:

1. Script to automatically download the hosts file (http://www.mvps.org/winhelp2002/hosts.htm) and update /etc/hosts. Cronned it to run once a week.

2. Script to automatically download bad-peers blocklists from bluetack and update deluge. Cronned it to run once a week.

3. Script to backup/restore my partitions.

4. System cleanup scripts.

5. Script to download (download only, no auto-installation!) updates from the repositories. Cronned to run daily.

barbedsaber
September 11th, 2008, 02:15 PM
working on the making coffee in the morning, feeding the dog, waking me up to song from my collection, adjusting the air con, and putting on some bacon.
(I love bacon)

kpkeerthi
September 11th, 2008, 02:17 PM
working on the making coffee in the morning, feeding the dog, waking me up to song from my collection, adjusting the air con, and putting on some bacon.
(I love bacon)

Well.. great. What BASH version do you have that does all that?

Trail
September 11th, 2008, 02:38 PM
I have a collection of material organized in my filesystem as `.../<year>/<name>/<author>_item'. I use a series of scripts to manage and index that stuff. For example, I maintain directories with symbolic links per year or per name or per creator, another directory with statistics such as largest directory size (as calculated through a maze of greps and awks and trs and stuff), and some other helper stuff for the occasional cleanup.

-grubby
September 11th, 2008, 02:46 PM
I have 2 cronjobs to backup remote mysql databases

beercz
September 11th, 2008, 02:54 PM
Cron job script to back up my home data to remote servers daily.
Cron job script to back up sql databases to remove servers daily.
Scipt to automatically download and install updates on my servers (which I run manually).

Also, as I am using Intrepid, I am having problems with nspluginwrapper package for playing flash movies. I have created a script that quickly installs a previous version should flash stop working because of updates to this package. At the moment I have synaptic locking the package to the version that works, but occasionally I update to the lastest version and if it doesn't work, I run my script to quickly revert back to the previous version. I am looking forward to this script being obsolete soon!

I have also written my own firewall script (based on iptables) but I no longer use it.

gvartser
September 11th, 2008, 03:44 PM
Have a lot of scripts, one of them has automated the whole DL process of nzb's.

1 Dl's all posts.
2 Repairs all files
3 Unpacks the files
4 Creates iso's

All i have to do is put in the writable media to burn.

Everything is initiated from a webpage.

And its quable so I can have unlimited DL's in the que.
/g

forger
September 11th, 2008, 03:59 PM
Post in a few sentences what tasks have you automated with custom shell scripts.

EDIT: Here is what I have:

1. Script to automatically download the hosts file (http://www.mvps.org/winhelp2002/hosts.htm) and update /etc/hosts. Cronned it to run once a week.

You'll have more success restricting adware/phishing sites by using www.opendns.com DNS servers :)

kpkeerthi
September 11th, 2008, 04:34 PM
You'll have more success restricting adware/phishing sites by using www.opendns.com DNS servers :)

I've been thinking about doing this for quite some time but been lazy or keep forgetting. lol!

Thanks for reminding, though! Will get this done by this week-end (hopefully!)

koenn
September 11th, 2008, 06:09 PM
working on the making coffee in the morning, feeding the dog, waking me up to song from my collection, adjusting the air con, and putting on some bacon.
(I love bacon)

This could help towards the dog feeding.
http://www.leeholmes.com/blog/DIYCatFeederAndWaterDispenser.aspx
it's cat oriented but probably customizable.

If you've made any progress on the making coffee in the morning, I'd be interested.

forger
September 11th, 2008, 08:09 PM
I've been thinking about doing this for quite some time but been lazy or keep forgetting. lol!
Thanks for reminding, though! Will get this done by this week-end (hopefully!)
No problem :) It's a 5-minute thing, even if you have a router it's *dead easy* - the more tricky part is to actually log in to opendns and control your locked websites using a dyndns-compatible client program, which takes a bit of more minutes :)

graabein
September 23rd, 2008, 02:22 PM
2. Script to automatically download bad-peers blocklists from bluetack and update deluge. Cronned it to run once a week.

3. Script to backup/restore my partitions.


Cron job script to back up my home data to remote servers daily.

I'm interested in these scripts. If you can post them or submit a link to where I can find examples that would be great.

I've just started reading about bash scripts because I want my file server to automatically download torrents when I drop a torrent file in a certain directory on the server.

Backing up my camera and document folder to the server each night would be sweet.

I'll do a search for rsync (or whatever it was called).

beercz
September 23rd, 2008, 03:22 PM
I'm interested in these scripts. If you can post them or submit a link to where I can find examples that would be great.

I've just started reading about bash scripts because I want my file server to automatically download torrents when I drop a torrent file in a certain directory on the server.

Backing up my camera and document folder to the server each night would be sweet.

I'll do a search for rsync (or whatever it was called).
Hi

I use rsnapshot (http://rsnapshot.org) within my script to execute my incremental backups - it is based on rsnyc, and uses ssh with keys.

I use my script to write a log file of my backup and send it to my machine that is being backed up, from the backup machine. It is my script that cron executes.

Here is the script:


#!/bin/bash

#script to backup ianpc
#April 2007

#reference for logfile
LOGFILE=/home/ian/ianpcbackup.log

#store the current date and time
TIMENOW=`date`

#add separator to log file
echo "================================================== ===========" >> "$LOGFILE"
echo "================================================== ===========" >> "$LOGFILE"

#add the date to log file
echo "Starting backup at $TIMENOW." >> "$LOGFILE"

#execute the backup
/usr/local/bin/rsnapshot -c /home/ian/apps/rsnapshotconfig/rsnapshot.conf daily > "$LOGFILE"

#add separator to log file
echo "================================================== ===========" >> "$LOGFILE"

#add timestamp and diskspace usage to log file
#store the current (finish) time
TIMENOW=`date`
echo "Finishing backup at $TIMENOW." >> "$LOGFILE"
df -h >> "$LOGFILE"

# copy logfile to ianpc - /home/ian/logs
scp "$LOGFILE" ian@192.168.0.2:/home/ian/logs

#finish
exit 0

kpatz
September 23rd, 2008, 03:33 PM
All sorts of stuff...

1. I have a script to notify me and update my ZoneEdit DNS if my dynamic IP changes (invoked by dhclient).

2. I have a script to update the 6 or so antivirus programs I have on my box to scan malware samples.

3. I have a script to scan malware samples with those 6 or so antivirus programs.

4. On my MythTV box, I have a script I use to update mpd's playlist when I load new music files.

5. I have a perl script that does reverse-DNS lookups for IPs that probe my firewall, used to update a database.

caljohnsmith
September 23rd, 2008, 03:37 PM
I've got a fun little script that does an ARP scan of all the other hosts on my LAN/WLAN, so I can see who else is using the network. It's a really quick way to make sure no nosy neighbors/wardrivers are leeching my WLAN, without having to log into my router to check. :)