Adding Startup And Shutdown Scripts in Ubuntu

I have my Ubuntu installed in Virtual Box. The very first thing that I needed to do was to setup my Ubuntu to recognize Windows drives. I setup two bash scripts to run at startup and shutdown. The following is what I have done.

anu@sw:/etc/init.d$ sudo vi vboxStartup
#!/bin/bash

# Mount the Win virtual drives - MyDocument, CShared, PidginWin
sudo mount -t vboxsf MyDocuments /mnt/MyDocuments
sudo mount -t vboxsf CShared /mnt/CShared
sudo mount -t vboxsf PidginWin /mnt/PidginWin

# Sync the files from PidginWin/logs to purple/logs
sudo rsync -azv /mnt/PidginWin/logs/ /home/anu/.purple/logs/
anu@sw:/etc/init.d$ sudo chmod +x vboxStartup
anu@sw:/etc/init.d$ sudo update-rc.d vboxStartup defaults

This way my ubuntu pidgin logs are in sync with my windows pidgin logs. Next, I also wanted my Windows pidgin logs to get sync with the Ubuntu pidgin logs whenever I log off. So I create yet another script

anu@sw:/etc/init.d$ sudo vi vboxShutdown
#!/bin/bash

echo "Anuvrat Shutdown Script -- vbox"

# Resync files from purple/logs/ to PidginWin/logs/
sudo rsync -azv /home/anu/.purple/logs/ /mnt/PidginWin/logs/
anu@sw:/etc/init.d$ sudo chmod +x vboxShutdown
anu@sw:/etc/init.d$ sudo update-rc.d vboxShutdown start 80 0 6 .

The funny thing though is that I haven’t yet tested it. I hope it works.

Oh crap! It did not run at startup. Need to check.

Popularity: 44% [?]

Related posts:

  1. My Ubuntu Intrepid + LAMP
  2. Installing Amarok 1.4 in Ubuntu Jaunty
  3. My First Impression Of Ubuntu Jaunty
  4. Vagalume – Last.fm Radio On Ubuntu Intrepid
  5. Ubuntu Lucid: Upgrading To Lynx In Virtualbox

blog comments powered by Disqus