Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 23rd October 2008
ninjatux's Avatar
ninjatux ninjatux is offline
Real Name: Baqir Majlisi
Spam Deminer
Join Date: May 2008
Location: Antarctica
Posts: 293
Default Automation Script

I use this script in Mac OS X to handle some startup actions that I need automated. What do you think of the script? It runs well, but would you do it this way or another way?

# startup_actions (Automator action-"Run Shell Script")

# Set appropriate PATH variable
export PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

# Wait 3 seconds for WiFi to come up
sleep 3

# Variable declarations

if [ 'ping -c $count "$TEST_SITE"' ] # Test for network connection
	# Create mount point if necessary
	if [ ! -e "$MOUNT_PT" ]
		mkdir "$MOUNT_PT"

	# Mount /home/ninjasb@starbox via sshfs
	if ifconfig | grep "$LOCAL_IP_TEST" > /dev/null # Test connection type for local or ext
		sshfs ninjasb@"$LOCAL_IP":/home/ninjasb "$MOUNT_PT" -oreconnect,volname=starbox_ninjasb
		sshfs ninjasb@"$EXT_IP":/home/ninjasb "$MOUNT_PT" -oreconnect,volname=starbox_ninjasb
	# Start mpd if it isn't already running
	if [ -z $(pidof mpd) ]
		sleep 1; mpd # Wait for sshfs mount to settle, then run mpd
	exit 0 # Fail-no internet connection
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity."
MacBook Pro (Darwin 9), iMac (Darwin 9), iPod Touch (Darwin 9), Dell Optiplex GX620 (FreeBSD 7.1-STABLE)
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crontab won't run script Petrocelli08 FreeBSD General 4 7th March 2009 04:19 AM
Backup script(s)? giddyupman General software and network 2 3rd January 2009 02:06 PM
Handy X11 script Gabe_G23 Guides 6 25th October 2008 05:08 PM
my 1st sh script graudeejs Programming 12 18th August 2008 10:25 PM
Shell Script. bsdnewbie999 Programming 21 15th July 2008 07:54 AM

All times are GMT. The time now is 10:24 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick