Linux开机自动运行

我的系统:Ubuntu 11.04 \n \l

修改文件/etc/rc.local,文件内容如下:


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/sbin/dhclient &>/tmp/dhclient.log
touch /home/maemo/12345.txt
service cron start
exit 0

这样,开机时,便会自动在/home/maemo/目录下生成一个新文件12345.txt;同时,启动定时服务cron。

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: