设为首页
收藏本站
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
平台
Portal
论坛
BBS
文库
项目
群组
Group
我的博客
Space
搜索
搜索
热搜:
shell
linux
mysql
本版
用户
LinuxSir.cn,穿越时空的Linuxsir!
»
论坛
›
Linux 发行版讨论区 —— LinuxSir.cn
›
Archlinux讨论区
›
求助:无法正常关机
返回列表
查看:
1166
|
回复:
7
求助:无法正常关机
[复制链接]
tigerwangxn
tigerwangxn
当前离线
积分
15
IP卡
狗仔卡
发表于 2007-6-12 12:26:26
|
显示全部楼层
|
阅读模式
前几天看贴说把rc.shutdown文件改了可以保护笔记本硬盘,可是后来发现无法正常关机了,重启也挂了,提示信息如下:
INIT: Switching to runlevel:6
INIT: Sending processes started by init TERM signal
INIT: cannot execute "/etc/rc.shutdown"
INIT: no more processes left in this runlevel
哪位高手帮帮忙啊!
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
显身卡
狱卒
狱卒
当前离线
积分
1689
IP卡
狗仔卡
发表于 2007-6-12 12:33:17
|
显示全部楼层
未修改過的rc.shutdown,自己參照著改回來(以後修改系統文件之前記得備份)。
#!/bin/bash
#
# /etc/rc.shutdown
#
. /etc/rc.conf
. /etc/rc.d/functions
# avoid staircase effect
/bin/stty onlcr
echo " "
printhl "Initiating Shutdown..."
echo " "
# avoid NIS hanging syslog-ng on shutdown by unsetting the domainname
if [ -x /bin/domainname ]; then
/bin/domainname ""
fi
if [ -x /etc/rc.local.shutdown ]; then
/etc/rc.local.shutdown
fi
if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then
# Shutdown daemons
let i=${#DAEMONS[@]}
while [[ i -ge 0 ]]; do
if [[ `echo ${DAEMONS[$i]} | grep '^[^\!]' | wc -l` -eq 1 ]]; then
/etc/rc.d/${DAEMONS[$i]#@} stop
fi
let i=i-1
done
# find any leftover daemons and shut them down
if [ -d /var/run/daemons ]; then
for daemon in `ls /var/run/daemons`; do
/etc/rc.d/$daemon stop
done
fi
fi
# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done
stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done
stat_busy "Saving Random Seed"
/bin/dd if=/dev/urandom of=/var/run/random-seed count=1 bs=512 2> /dev/null
stat_done
stat_busy "Saving System Clock"
if [ "$TIMEZONE" != "" -a -e /usr/share/zoneinfo/$TIMEZONE ]; then
/bin/rm -f /etc/localtime
/bin/cp /usr/share/zoneinfo/$TIMEZONE /etc/localtime
fi
if [ "$HARDWARECLOCK" = "UTC" ]; then
/sbin/hwclock --directisa --utc --systohc
else
/sbin/hwclock --directisa --localtime --systohc
fi
stat_done
# removing psmouse module to fix some reboot issues on newer laptops
modprobe -r psmouse >/dev/null 2>&1
# Write to wtmp file before unmounting
/sbin/halt -w
stat_busy "Deactivating Swap"
/sbin/swapoff -a
stat_done
stat_busy "Unmounting Filesystems"
/bin/umount -a -t noramfs,notmpfs,nosysfs,noproc
stat_done
# Kill non-root encrypted partition mappings
if [ -f /etc/crypttab -a -n "$(grep -v ^# /etc/crypttab | grep -v ^$)" ]; then
stat_busy "Deactivating encrypted volumes:"
CS=/sbin/cryptsetup.static
do_uncrypt() {
if [ $# -ge 3 ]; then
stat_append "${1}.."
$CS remove $1 >/dev/null 2>&1
if [ $? -ne 0 ]; then
stat_append "failed "
else
stat_append "ok "
fi
fi
}
while read line; do
eval do_uncrypt "$line"
done </etc/crypttab
stat_done
fi
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -x /sbin/lvm -a -d /sys/block ]; then
stat_busy "Deactivating LVM2 groups"
/sbin/lvm vgchange --ignorelockingfailure -an >/dev/null 2>&1
stat_done
fi
fi
stat_busy "Remounting Root Filesystem Read-only"
/bin/mount -n -o remount,ro /
stat_done
# Power off or reboot
if [ "$RUNLEVEL" = "0" ]; then
printsep
printhl "${C_H2}POWER OFF"
/sbin/poweroff -d -f -h -i
else
printsep
printhl "${C_H2}REBOOTING"
# if kexec is installed and a kernel is loaded, use it
[ -x /sbin/kexec ] && /sbin/kexec -e > /dev/null 2>&1
/sbin/reboot -d -f -i
fi
# End of file
# vim: set ts=2 noet:
复制代码
回复
支持
反对
使用道具
举报
显身卡
tigerwangxn
tigerwangxn
当前离线
积分
15
IP卡
狗仔卡
楼主
|
发表于 2007-6-12 12:39:59
|
显示全部楼层
我已经把那个删了重新改回去了,可是还是不行,不知道怎么回事啊?
回复
支持
反对
使用道具
举报
显身卡
狱卒
狱卒
当前离线
积分
1689
IP卡
狗仔卡
发表于 2007-6-12 13:04:39
|
显示全部楼层
pacman -S initscripts
重新安裝initscripts呢?
回复
支持
反对
使用道具
举报
显身卡
tigerwangxn
tigerwangxn
当前离线
积分
15
IP卡
狗仔卡
楼主
|
发表于 2007-6-12 13:09:22
|
显示全部楼层
ok啦!这次好了,刚是在win下面复制你的文件,所以进arch无法正常显示,我用朋友给我传的文件覆盖掉以前的,现在好了!谢啦!
回复
支持
反对
使用道具
举报
显身卡
skee.crackpot
skee.crackpot
当前离线
积分
70
IP卡
狗仔卡
发表于 2007-6-12 13:11:52
|
显示全部楼层
> 我已经把那个删了重新改回去了,可是还是不行,不知道怎么回事啊?
是不是忘了给rc.shutdown加“可执行”属性?
sudo chmod 755 /etc/rc.shutdown
回复
支持
反对
使用道具
举报
显身卡
tigerwangxn
tigerwangxn
当前离线
积分
15
IP卡
狗仔卡
楼主
|
发表于 2007-6-12 13:18:49
|
显示全部楼层
默认就是可执行的啊,你直接删了用把以前的文件加进去应该就好了!
回复
支持
反对
使用道具
举报
显身卡
skee.crackpot
skee.crackpot
当前离线
积分
70
IP卡
狗仔卡
发表于 2007-6-12 14:01:41
|
显示全部楼层
> 默认就是可执行的啊,你直接删了用把以前的文件加进去应该就好了!
呵呵,误会了。
我以为你说的“把那个删了”指的是:
rm /etc/rc.shutdown
然后再
cp /xxx/../rc.shutdown.original /etc/rc.shutdown
或
vi /etc/rc.shutdown
回复
支持
反对
使用道具
举报
显身卡
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
Copyright © 2002-2023
LinuxSir.cn
(http://www.linuxsir.cn/) 版权所有 All Rights Reserved.
Powered by
RedflagLinux!
技术支持:
中科红旗
|
京ICP备19024520号
快速回复
返回顶部
返回列表