Changes

From Amahi Wiki
Jump to: navigation, search
2,287 bytes removed ,  01:27, 27 April 2014
with
mysql -u root -phda -e "select comment from shares" hda_production | grep -v "^comment$" | xargs -d "\n" mkdir -p     ### BEGIN INIT INFO # Provides: mount_shares_locally # Required-Start: $network $local_fs $remote_fs smb mysqld # Required-Stop: $network $local_fs $remote_fs smb # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: mount Samba shares locally ### END INIT INFO username="YOURUSERHERE" if [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions fi start () { uid=`id -u $username` gid=`id -g $username` echo -n $"Mounting Samba shares locally: " mkdir -p /mnt/samba/ mkdir -p /mnt/apache/ cd /mnt/apache/ testparm -s /etc/samba/smb.conf 2>/dev/null | grep "^\[" | grep -v "\[global\]" | grep -v "\[homes\]" | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d "\n" mkdir -p cd /mnt/samba/ testparm -s /etc/samba/smb.conf 2>/dev/null | grep "^\[" | grep -v "\[global\]" | grep -v "\[homes\]" | awk -F'[' '{print $2}' | awk -F']' '{print $1}' | xargs -d "\n" mkdir -p sleep 5 ls -1 | while read d; do /sbin/mount.cifs "//127.0.0.1/$d" "$d" -o credentials=/home/${username}/.smb_credentials,uid=${uid},gid=${gid},file_mode=0660,dir_mode=0770,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks /sbin/mount.cifs "//127.0.0.1/$d" "/mnt/apache/$d" -o credentials=/home/${username}/.smb_credentials,uid=`id -u apache`,gid=`id -g apache`,file_mode=0777,dir_mode=0777,nobrl,hard,_netdev,iocharset=utf8,noserverino,mfsymlinks done touch /var/lock/subsys/mount_shares_locally success $"$base startup" echo return 0 } stop () { echo -n $"Unmounting locally mounted Samba shares: " /bin/umount -l /mnt/samba/* /bin/umount -l /mnt/apache/* rm -f /var/lock/subsys/mount_shares_locally success $"$base shutdown" echo return 0 } restart () { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 ;; esac exit $?
12,424

edits