#! / bin / bash # chkconfig: chkconfig --Add filename # path: /etc/inc.d/init.d/filename# processname: filename
Retval = 0Prog = "filename"
START () {echo -n $ "starting ..." su - root -c "mount -t ntfs / dev / hda5 / mnt / d" su - root -c "mount -t ntfs / dev / hda6 / mnt / e "su - root -c" mount -t ntfs / dev / hda7 / mnt / f "su - oracle -c" dbstart "su - oracle -c" lsnrctl start "RetVal = $? Echo [$ RETVAL-EQ 0] && touch / VAR / LOCK / SUBSYS / $ PROG RETURN $ RETVAL}
STOP () {echo -n $ "shutting down" su - oracle -c "lsnrctl stop" su - oracle -c "dbshut" su - root -c "umount / dev / hda5" su - root -c "umount / dev / hda6 "Su - root -c" umount / dev / hda7 "RETVAL = $? Echo [$ RETVAL-EQ 0] && rm -f / var / limited}
# See How We Were Called.case "$ 1" in Start) Start ;; STOP) Stop ;; *) Echo $ "Usage: $ 0 {start | stop}" EXIT 1ESAC
EXIT $ RETVAL
------------------------------------- above is the script ---------- --------------------------------------------
Just modify the green and red part, green is the start-up section, red is stopped, you control your own stop
The order, the following is a brief explanation.
Su - root -c "mount -t ntfs / dev / hda7 / mnt / f"
The meaning of this sentence is to use the root user execute command: mount -t ntfs / dev / hda7 / mnt / f
In fact, there is an annotation, save this script into a file, give him 700 permissions, root: root users,
Copy to the /etc/inc.d/init.d/ This directory, then execute the command: chkconfig --Add file name
If there is no error, start NTSYSV, select your file name, determine, well, automatically stop the database later,
Automatically load / uninstall Windows NTFS format hard drive.
note:
Oracle users use dbstart, dbshut commands need to change n to Y.