LinHES Forums

bash wrapper script for mythfrontend needed - please help
Page 1 of 1

Author:  graysky [ Wed Mar 04, 2009 11:46 am ]
Post subject:  bash wrapper script for mythfrontend needed - please help

I'd like a bash wrapper script that will run on my FE machine and will insure that the MBE is up and running before running mythfrontend thus avoiding the screen prompting a user for the IP address of the backend which drives my wife nuts.

The script needs to:

1) Check to see if the NFS mount is active (/mnt/share in my case)

2a) If it's not active, try to mount it
2b) If it won't mount because the MBE nfs server is down, seep for 60s and try again looping indefinitely until the MBE server is up

3) Once the mount is active, run mythfrontend and exit

Here is the line to the mount in question from my /etc/fstab
Code: /mnt/share nfs defaults,auto,noatime 0 0

I took a stab it this, but I'm not sure how to accomplishing the looping and my code isn't very elegant. Anyone out there particularly bash-savvy?

Author:  slowtolearn [ Wed Mar 04, 2009 6:23 pm ]
Post subject: 

Something like this should get you started (not tested):
while :
   [ -n "`mount | grep /mnt/share`" ] && {
      <whatever you want to do here>
      exit 0
   } || {
      mount /mnt/share
      sleep 5

You could place this script at the end of your normal startup stuff and just let it exit when the share is active, or add whatever commands you like in place of <whatever you want to do here>.

We're assuming that if you can mount the NFS share then the backend is running? I would guess that rpc/portmappper is started before the backend, you'll want to verify.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group