PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : sambashare automatisch mounten



mase-faq
22.05.04, 15:52
Hallo!
Gibt es bei Debian Sid die Möglichkeit, einen Sambashare beim Systemstart automatisch
zu mounten?
Bei Suse gab's da ja immer die smbfstab.
Vor allem, wenn der Samba-Server auch noch ein Password verlangt.

Kernel-Error
22.05.04, 22:25
Hi!

Im Notfall würde ich es über ein init script machen! Es sollte sich aber auch in die fstab tippen lassen! Einfach mal ein bissel im Forum Suchen. Die Frage hatten wir bestimmt schon mal!

Habe einige Zeilen tiefer das hier gesehen:
http://www.linuxforen.de/forums/showthread.php?t=137002

Nur so am Rande....

Grüße

:ugly: Kernel-Error :ugly:

mase-faq
23.05.04, 09:47
Hab's hingekriegt mit der fstab.
Doch kann ich mir untr Debian einfach ne smbfstab anlegen?

drcux
23.05.04, 09:54
glaub ich nicht, da unter SuSE ein Startscript existiert, das diese Datei auswertet:

/etc/init.d/smbfs

Kernel-Error
23.05.04, 12:33
Hi!

glaub ich nicht, da unter SuSE ein Startscript existiert, das diese Datei auswertet:

/etc/init.d/smbfs

Das init-script sollte sich doch aber auch auf sein System anpassen lassen.

Könnte es mal jemand hier posten? Mich würde interessieren was genau das script macht!

Grüße


:ugly: Kernel-Error :ugly:

Stormbringer
23.05.04, 12:48
Das Skript /etc/init.d/smbfs einer SuSE 8.2:


#! /bin/bash
# Copyright (c) 1999-2003 SuSE Linux AG, Nuernberg, Germany.
#
# Author: Thomas Fehr, 1999-2001
# Lars Mueller <lmuelle@suse.de>, 2002-2003
#
# /etc/init.d/smbfs
#
### BEGIN INIT INFO
# Provides: smbfs
# Required-Start: $network syslog
# X-UnitedLinux-Should-Start: nmb
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Import remote SMB/CIFS (MS Windows) file systems
### END INIT INFO

# To access SMB/ CIFS servers beyond the network broadcast domain it may be
# necessary to also activate the nmb service. Also see section 'smbfs and nmb
# service' in /usr/share/doc/packages/samba/README.SuSE

# Status shell functions
. /etc/rc.status
# Reset status of this service
rc_reset

SMBFSTAB="/etc/samba/smbfstab"

grep smbfs /proc/mounts >/dev/null
test $? -eq 0 && smbfs_used=yes || smbfs_used=no

case "$1" in
start)
grep -v ^# /etc/fstab | grep smbfs >/dev/null
rc=$?
if [ ! -f ${SMBFSTAB} -a ${rc} -ne 0 ]; then
echo -n "No ${SMBFSTAB} found and no type smbfs active in /etc/fstab."
rc_status -s
exit 6
fi
echo -n "Mount SMB File System"
service_used="no"
if [ ${rc} -eq 0 ]; then
timer=30
rc=0
while [ ${rc} -eq 0 ] && [ ${timer} -gt 0 ]; do
echo
echo -n "from /etc/fstab"
mount -at smbfs >/dev/null &
jobs | grep Running >/dev/null
rc=$?
if [ ${rc} -ne 0 ]; then
timer=$[${timer}-1]
echo -n "."
sleep 1
fi
done
if [ ${rc} -eq 0 -a ${timer} -eq 0 ]; then
echo " Error: timeout while mount."
rc_failed
fi
rc_status -v
fi
timer=-1
while read service mountpoint options; do
case "${service}" in
""|\#*|\;*) continue ;;
esac
test ${timer} -eq -1 && echo -n "from ${SMBFSTAB}"
test ${service_used} = "no" && service_used="yes"
echo
echo -n "${service} on ${mountpoint}"
rc_reset
timer=30
rc=0
while [ ${rc} -eq 0 ] && [ ${timer} -gt 0 ]; do
mount -t smbfs -o ${options} ${service} ${mountpoint} &
jobs | grep Running >/dev/null
rc=$?
if [ ${rc} -ne 0 ]; then
timer=$[${timer}-1]
echo -n "."
sleep 1
fi
done
if [ ${rc} -eq 0 -a ${timer} -eq 0 ]; then
echo " Error: timeout while mount."
rc_failed
fi
rc_status -v
done < ${SMBFSTAB}
test ${service_used} = "no" && rc_status -u
;;
stop)
echo -n "Umount SMB File System"
if [ "${smbfs_used}" = "yes" ]; then
#
# Unmount in background because during long timeouts
#
timer=30
rc=0
while [ ${rc} -eq 0 ] && [ ${timer} -gt 0 ]; do
umount -at smbfs &
jobs | grep Running >/dev/null
rc=$?
if [ ${rc} -ne 0 ]; then
timer=$[${timer}-1]
echo -n "."
sleep 1
fi
done
if [ ${rc} -eq 0 -a ${timer} -eq 0 ]; then
echo " Error: timeout while umount."
rc_failed
fi
rc_status -v
else
rc_status -u
fi
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
rc_status
;;
reload)
echo -n "Reload mounted SMB File System"
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for mounted SMB File System"
if [ "${smbfs_used}" = "yes" ]; then
mount -t smbfs | while read service on mountpoint rest; do
echo
echo -n ${service} on ${mountpoint}
done
else
rc_failed 3
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|reload|restart}"
exit 1
esac
rc_exit


Gruß

mase-faq
05.06.04, 17:38
Also diese Script funzt nicht, wegen dem rc_status.
Hat jemand ein geeignetes für Debian?

aheinhold
05.06.04, 21:05
Hallo,

warum schreibst du dir nicht selbst ein Startscript?
Natürlich kannst du auch ein vorhandenes Debian Script umbauen!