[root@AlexServer ~]# /etc/init.d/mount_shares_locally start
Mounting Samba shares locally: ERROR 1054 (42S22) at line 1: Unknown column 'name' in 'field list'
mkdir: missing operand
Try `mkdir --help' for more information.
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Retrying with upper case share name
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[ OK ]
My script is currently as follows:
I suspect that the "mysql -u root -phda -e "select name from shares" hda_production | grep -v "^name$" | xargs -d "\n" mkdir -p" line is what the problem is.#!/bin/sh
#
### 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="alex";
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/
cd /mnt/samba/
mysql -u root -phda -e "select name from shares" hda_production | grep -v "^name$" | xargs -d "\n" mkdir -p
sleep 10
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
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/*
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
Should I just C+P the script (and edit username obviously), that is located in https://wiki.amahi.org/index.php/Mount_Shares_Locally ?
Thank you!