1 - add option to mount drive during boot, but the /etc/fstab is automatically re-generated every boot
This is my current /etc/fstab content
Code: Select all
# Do not edit this file as fstab is recreated automatically during every boot.
# Please use /etc/rc.d/rc.local or sysvinit scripts if you want to mount/unmount
# drive, filesystem or network share.
# System mounts:
aufs / aufs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devtmpfs /dev devtmpfs defaults 0 0
devpts /dev/pts devpts rw,mode=0620,gid=5 0 0
# Device partitions:
# Hotplugged devices:
/dev/sdb1 /mnt/sdb1 ext4 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda1 /mnt/sda1 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda6 /mnt/sda6 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda3 /mnt/sda3 ext2 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda2 /mnt/sda2 swap users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc2 /mnt/sdc2 ext2 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sda5 /mnt/sda5 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc3 /mnt/sdc3 ext3 users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
/dev/sdc1 /mnt/sdc1 exfat users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
Code: Select all
/dev/sdc1 /mnt/sdc1 exfat users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
Code: Select all
/dev/sdc1 /mnt/sdc1 exfat rw,users,noatime,nodiratime,suid,dev,exec,async,comment=x-gvfs-show 0 0
But thinking better i prefer some partitions mount by "label" instead of /mnt/sd[X#] for example /dev/sda1 on my machine had label "Compartido" i prefer that mount on /mnt/Compartido.
Well the another thing i want to mount during boot is some mount intranet cifs folders, because samba not mount correctly
i just thinking how i should use the /etc/rc.d/rc.local file for mounts things i need, for example something like :
Code: Select all
#CIFS Mount(s) :
#First, create folders for mountpoints
mkdir -p /mnt/cifs/Temporal
mkdir -p /mnt/cifs/Inukaze
mkdir -p /mnt/cifs/Inukaze-en-Familia
mkdir -p /mnt/cifs/Josmar
#Second, mount cifs. i need to know how i can enable the options for allow my cifs user can delete files from cifs.
# Because the option "dir_mode=01777" , let me create files, but does not allow me delete files and/or folders.
#i need improve this part for check on background if 192.168.1.10 is accesible, and if not is accesible just ignore it and continue normally
mount -t cifs //192.168.1.10/Inukaze /mnt/cifs/Inukaze -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Inukaze-en-Familia /mnt/cifs/Inukaze-en-Familia -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Temporal /mnt/cifs/Temporal -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
mount -t cifs //192.168.1.10/Josmar /mnt/cifs/Josmar -o vers=1.0,username=inukaze,password=inukaze,dir_mode=01777,domain=REDLOCAL
Code: Select all
#Force Clock Sync via NTP :
ntpdate=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b ntpdate | grep -i "ntpdate" | cut -d " " -f02 | cut -c11-20)
service=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b service | grep -i "service" | cut -d " " -f02 | cut -c11-20)
rcntpd="/etc/rc.d/rc.ntpd"
if [ -z "$ntpdate" ]; then
echo
echo "ntpdate no esta instalado en tu sistema operativo GNU"
echo "Por favor, instale primero ntpdate "
echo
exit 0
fi
#Slackware(64) :
if [ -d "/etc/rc.d" ];then
if [ -f "$rcntpd" ]; then
chmod +x "$rcntpd"
"$rcntpd" "stop"
#ntpdate -u 0.south-america.pool.ntp.org
ntpdate -u time.nist.gov
hwclock -w
"$rcntpd" "start"
fi
fi
#Debians :
if [ -z "$service" ]; then
echo ""
else
sudo service ntpd stop
sudo su -c "rm -rf /etc/localtime" root
sudo su -c "ln -s /usr/share/zoneinfo/America/Caracas /etc/localtime" root
echo 'TZ='America/Caracas'; export TZ' >> "$HOME/.profile" ; source "$HOME/.profile"
sudo update-locale LC_TIME=es_ES.UTF-8
#ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES /usr/share/i18n/locales/es_ES" root
#ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_ES@euro /usr/share/i18n/locales/es_ES@euro" root
#ES#sudo su -c "cp -rf $PWD/usr/share/i18n/locales/es_VE /usr/share/i18n/locales/es_VE" root
LANG="es_ES.UTF-8" ; export LANG="$LANG"
LANGUAGE="es_ES.UTF-8" ; export LANGUAGE='"'"$LANGUAGE"'"'
LC_ALL="es_ES.UTF-8" ; export LC_ALL="$LC_ALL"
# ntpdate -u 0.south-america.pool.ntp.org ; hwclock -w
ntpdate -u time.nist.gov ; hwclock -w
sudo service ntpd start
fi
Code: Select all
#!/bin/sh
# Start/stop/restart ntpd.
# Start ntpd:
ntpd_start() {
CMDLINE="/usr/sbin/ntpd -g"
echo -n "Starting NTP daemon: $CMDLINE"
$CMDLINE -p /var/run/ntpd.pid
echo
}
# Stop ntpd:
ntpd_stop() {
echo -n "Stopping NTP daemon..."
if [ -r /var/run/ntpd.pid ]; then
kill -HUP $(cat /var/run/ntpd.pid)
rm -f /var/run/ntpd.pid
else
killall -HUP -q ntpd
fi
echo
}
# Restart ntpd:
ntpd_restart() {
ntpd_stop
sleep 1
ntpd_start
}
# Check if ntpd is running
ntpd_status() {
if [ -e /var/run/ntpd.pid ]; then
echo "ntpd is running."
else
echo "ntpd is stopped."
exit 1
fi
}
case "$1" in
'start')
ntpd_start
;;
'stop')
ntpd_stop
;;
'restart')
ntpd_restart
;;
'status')
ntpd_status
;;
*)
echo "usage $0 start|stop|restart|status"
esac
Code: Select all
#!/bin/sh
#
# /etc/rc.d/rc.samba
#
# Start/stop/restart the Samba SMB file/print server.
#
# To make Samba start automatically at boot, make this
# file executable: chmod 755 /etc/rc.d/rc.samba
#
samba_start() {
if [ -x /usr/sbin/smbd -a -x /usr/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
mkdir -p /var/run/samba
echo "Starting Samba: /usr/sbin/smbd -D"
/usr/sbin/smbd -D
echo " /usr/sbin/nmbd -D"
/usr/sbin/nmbd -D
elif [ ! -r /etc/samba/smb.conf ]; then
echo "ERROR: cannot start Samba since /etc/samba/smb.conf does not exist"
fi
}
samba_stop() {
killall smbd nmbd
}
samba_restart() {
samba_stop
sleep 2
samba_start
}
case "$1" in
'start')
samba_start
;;
'stop')
samba_stop
;;
'restart')
samba_restart
;;
*)
# Default is "start", for backwards compatibility with previous
# Slackware versions. This may change to a 'usage' error someday.
samba_start
esac