Set boot auto-start item under ubuntu

Here, the system in Ubuntu does not have the chkconfig command in the RH system !

There are some small tools to manage Ubuntu 's boot options:
small tool rcconf :
#sudo apt-get rcconf
#sudo apt-get install rcconf
run as root: #sudo rcconf
More full-featured tool : sysv-rc-conf
#sudo apt- get update
#sudo apt-get install sysv-rc-conf
run: #sudo sysv-rc-conf
can also be directly added to the startup program, such as adding /etc/init.d/red5 to the system auto-start list: other usage methods See: google::Ubuntu::sysv-rc-conf command usage
#sudo sysv-rc-conf red5 on

You can also directly modify
the things under /etc/rc0.d ~ /etc/rc6.d and /etc/rcS.d. The one starting with S means to start, and the one starting with K means not to start.
For example, if you want to turn off the boot of Red5 To start automatically, just #sudo mv /etc/rc2.d/S20red5 /etc/rc2.d/K20red5 will do.

Ubuntu autostart program

First of all, the service programs that Linux randomly starts are all in the /etc/init.d folder, and the files in it are all script files (the script program simply means that the program to be run is written into a file so that the system can press Sequential execution, similar to the autorun.dat file under windows), and in the /etc folder there are folders named rc1.d, rc2.d until rc6.d, these are different runlevels of linux, The operating level of the X windows multi-user that we generally enter is the fifth level, that is, rc5.d. The script file in this folder is the service program to be started randomly when the fifth level is run. It should be noted that the files in each rc (1-6).d folder are actually a soft link to the files in the /etc/init.d folder (similar to shortcuts in windows), that is It is said that under the /etc/init.d folder are all the service programs, and each rc(1-6).d only links the corresponding service programs that it needs to start!

To start scim (a program), we first need to know where the scim program is, which can be found with the locate command. scim is in /usr/bin/scim, where usr means it belongs to the user, and bin means executable in linux program. In this way, I can write a script program, put it in /etc/init.d, and then make a corresponding soft link in rc5.d.

This script is actually very simple, just two lines:

#!/bin/bash

/usr/bin/scim

The first line declares what terminal to use to run the script, and the second line is the command to run.

It should also be noted that, in rc5.d, the name of each link starts with S or K. The name that starts with S means that the system starts to be started randomly, and the name that starts with K does not start randomly. In this way, you can know that if I want a service to be started randomly, just change the first letter K of its name to S. Of course, after changing S to K, the service cannot be started randomly. Therefore, I also name this link SXXX, so that the system can make it start randomly.

Under RH, rc.local is the last script file started by default, so,
如果你想要随机启动,还有一种方法就是在rc.local的尾部加入/usr/bin/scim,这样就可以了。

Linux 自动启动程序

1.开机启动时自动运行程序

Linux 加载后, 它将初始化硬件和设备驱动, 然后运行第一个进程init。init根据配置文件继续引导过程,启动其它进程。通常情况下,修改放置在 /etc/rc或 /etc/rc.d 或 /etc/rc?.d 目录下的脚本文件,可以使init自动启动其它程序。例如:编辑 /etc/rc.d/rc.local 文件(该文件通常是系统最后启动的脚本),在文件最末加上一行“xinit”或“startx”,可以在开机启动后直接进入X-Window。

2.登录时自动运行程序

用 户登录时,bash首先自动执行系统管理员建立的全局登录script :/ect/profile。然后bash在用户起始目录下按顺序查找三个特殊文件中的一个:/.bash_profile、/.bash_login、 /.profile,但只执行最先找到的一个。
因此,只需根据实际需要在上述文件中加入命令就可以实现用户登录时自动运行某些程序(类似于DOS下的Autoexec.bat)。

3.退出登录时自动运行程序

退出登录时,bash自动执行个人的退出登录脚本/.bash_logout。例如,在/.bash_logout中加入命令“tar -cvzf c.source.tgz *.c”,则在每次退出登录时自动执行 “tar” 命令备份 *.c 文件。

4.定期自动运行程序

Linux有一个称为crond的守护程序,主要功能是周期性地检查 /var/spool/cron目录下的一组命令文件的内容,并在设定的时间执行这些文件中的命令。用户可以通过crontab 命令来建立、修改、删除这些命令文件。

例如,建立文件crondFile,内容为“00 9 23 Jan * HappyBirthday”,运行“crontab cronFile”命令后,每当元月23日上午9:00系统自动执行“HappyBirthday”的程序(“*”表示不管当天是星期几)。

5.定时自动运行程序一次

定时执行命令at 与crond 类似(但它只执行一次):命令在给定的时间执行,但不自动重复。at命令的一般格式为:at [ -f file ] time ,在指定的时间执行file文件中所给出的所有命令。也可直接从键盘输入命令:

$ at 12:00
at>mailto Roger -s ″Have a lunch″ < plan.txt
at>Ctr-D
Job 1 at 2000-11-09 12:00
2000-11-09 12:00时候自动发一标题为“Have a lunch”,内容为plan.txt文件内容的邮件给Roger。?9 12:00
2000-11-09 12:00时候自动发一标题为“Have a lunch”,内容为plan.txt文件内容的邮件给Roger。er。ger。er。

Ubuntu 开机自动挂载windows分区

要挂载NTFS格式分区,需要NTFS-3g这个软件。它短小精悍,而且功能强大。
NTFS-3g是一个开源软件,它支持在Windows下面读写NTFS格式的分区。它非常的快速,同时也很安全。它支持Windows 2000、XP和2003,并且支持所有的符合POSIX标准的磁盘操作。

首先要编辑sources.list
#sudo gedit /etc/apt/sources.list

Ubuntu Drapper添加:
deb http://givre.cabspace.com/ubuntu/ dapper main main-all
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ dapper main main-all
deb http://flomertens.keo.in/ubuntu/ dapper main main-all

Ubuntu Edgy添加:
deb http://givre.cabspace.com/ubuntu/ edgy main
deb http://ntfs-3g.sitesweetsite.info/ubuntu/ edgy main
deb http://flomertens.keo.in/ubuntu/ edgy main

同时必须导入GPG-Key,可以这样:
#wget http://flomertens.keo.in/ubuntu/givre_key.asc -O- | sudo apt-key add -
#wget http://givre.cabspace.com/ubuntu/givre_key.asc -O- | sudo apt-key add -

现在更新一下源:
#sudo aptitude update

正式安装

在“终端”下面运行:
#sudo apt-get install ntfs-3g

配置NTFS-3g

首先看一些硬盘分区的分区类型
#sudo fdisk -l

现在就可以修改 /etc/fstab,来让Ubuntu启动的时候自动挂载NTFS分区了。但是首先请备份一下这个文件:
#sudo cp /etc/fstab /etc/fstab.bak

建立挂载点,譬如挂载在 /media/windows 下面
#sudo mkdir /media/windows

现在可以在 /etc/fstab 的后面添加
/dev/hda1 /media/ ntfs-3g defaults,locale=zh_CN.utf8 0 0
根据自己的情况进行修改。

一些示例

挂载 /dev/hda3
添加 /dev/hda3 /media/windows ntfs-3g ro,locale=zh_CN.utf8,uid=1000 0 0

关于自己的locale

可以用下面的命令查看所有的locale
#locale -a

如果不想重新启动,就可以
#sudo umount -a
#sudo mount -a

最后一个挂载FAT分区的命令
#sudo mount /dev/hda3 /media/windows/ -t vfat -o iocharset=utf8,umask=000

当然可以在/etc/fstab里面添加
/dev/hda3 /media/windows vfat iocharset=utf8,umask=000 0 0

Openfire随着Ubuntu自动启动

openfire缺省情况下,是不随机启动的。为了解决每次都要手工启动的麻烦,我编写了一个脚本,放在/etc/init.d目录里面
#sudo vim /etc/init.d/openfire
内容如下:

#!/bin/sh

openfire_start(){
/etc/openfire/bin/openfire start
}

openfire_stop(){
/etc/openfire/bin/openfire stop
}

case $1 in
start)
openfire_start
;;
stop)
openfrie_stop
;;
*)
echo ‘Usage:openfire start|stop’
;;
esac

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326487018&siteId=291194637