How to Set auto-start options in Ubuntu

Source: Internet
Author: User
The chkconfig command in the Rh system is unavailable in Ubuntu!

You can use some gadgets to manage the startup options of Ubuntu:
Small Tool rcconf:
# Sudo apt-Get rcconf
# Sudo apt-Get install rcconf
Run the following command under root: # sudo rcconf
More comprehensive tools: sysv-RC-Conf
# Sudo apt-Get update
# Sudo apt-Get install sysv-RC-Conf
Run: # sudo sysv-RC-Conf
You can also directly add the startup program, for example, add/etc/init. d/red5 to the Automatic startup list of the system:
# Sudo sysv-RC-conf red5 on
For other usage methods, see Google: Ubuntu: sysv-RC-Conf.

You can also directly modify
Directly change/etc/rc0.d ~ /Etc/rc6.d and/etc/RCs. d
Starting with S, starting with K means not starting,
For example, if you want to disable automatic startup of red5, you only need to # sudo mV/etc/rc2.d/s20red5
/Etc/rc2.d/k20red5.

Ubuntu automatically starts the program

First of all, the services started randomly in Linux are all in the/etc/init. d folder, and all the files in it are script files (the script program simply writes the program to be run
To one
File to allow the system to execute in order, similar to the Autorun. dat file in Windows), and in the/etc folder, there are also files named rc1.d,
Rc2.d to rc6.d. These are Linux runlevels.
The running level of multiple users in Windows is 5th, that is, rc5.d. The script file in this folder is the service program to be randomly started when the running level is 5th. Note that in each RC
(1-6) the files in the. D folder are actually a soft connection to the files in the/etc/init. d folder (similar to the shortcut in Windows), that is, in
The/etc/init. d folder contains all the service programs, and each RC (1-6). d only links it to start the desired service program!

To start scim
(A Program), we first need to know where the scim program is, which can be found by using the locate command. scim is in/usr/bin/scim, where the USR table
Show Yes
Belongs to the user. Bin indicates programs that can be executed in Linux. In this way, I can write a script program, put it in/etc/init. d, and then make a phase in rc5.d.
Soft link.

This script is actually very simple, just two lines:

#! /Bin/bash

/Usr/bin/scim

The first line is to declare the terminal used to run the script, and the second line is the command to run.

Also
Note that in rc5.d, each link name starts with S or K, and s indicates that the system starts randomly, k starts with a random start. This
If you want to start a service at random, you can change the first letter K to S. Of course, after changing S to K, this service cannot be started randomly. Therefore, I am using this link
Also name it sxxx so that the system can start it at random.
In RH, RC. Local is the last script file started by default. Therefore,
If you want to start the instance at random, add/usr/bin/scim to the end of RC. Local.

Linux Automatic startup program

1. automatically run the program at startup

After Linux is loaded, it initializes hardware and device drivers,
Then run the first process init. Init starts other processes based on the configuration file. Normally, the changes are placed in
/Etc/rc or/etc/rc. d or/etc/rc ?. D
Directory to enable init to automatically start other programs. Example: Edit
/Etc/rc. d/rc. Local
File (this file is usually the last script started by the system). Add "xinit" or "startx" at the end of the file to directly enter X-window after the file is started.

2. automatically run the program upon Logon

When a user logs on, bash automatically executes the global logon script created by the system administrator.
:/ECT/profile. Bash then searches for one of the three special files in sequence in the user's starting Directory:/. bash_profile,/. bash_login,
/. Profile, but only the first one found is executed.
Therefore, you only need to add commands to the above files as needed to automatically run certain programs (similar to autoexec. BAT in DOS) during user logon ).

3. automatically run the program upon logon.

When you log out, bash automatically runs the personal logout script/. bash_logout. For example, add the command "tar" to/. bash_logout.
-Cvzf C. Source. tgz *. c ": automatically runs the" tar "command to back up *. c
File.

4. Periodically run the program automatically

Linux has a daemon called crond. Its main function is to periodically check
The contents of a group of command files under the/var/spool/cron directory, and execute the commands in these files at the specified time. You can use crontab
Command to create, modify, and delete these command files.

For example, create a crondfile with the content "00 9 23 Jan *
Happybirthday, Run "crontab
After the cronfile "command, the system automatically runs the" happybirthday "Program (" * "indicates that no matter the day of the day) at AM on March 23, lunar January ).

5. automatically run the program once at a scheduled time

Scheduled command execution at and crond
Similar (but it only runs once): The command is executed at a given time, but not automatically repeated. The general format of the AT command is:
[-F file] Time
To execute all the commands in the file at the specified time. You can also enter the command directly from the keyboard:

$ At 12: 00
At> mailto Roger-s "have a lunch" <plan.txt
At> CTR-d
Job 1
Automatic release of a Mark entitled "have
Lunch, which contains emails from the plan.txt file to Roger .?
Automatic release of a Mark entitled "have
Lunch, which contains emails from the plan.txt file to Roger. Er. Ger. Er.

Automatically mount Windows partitions when Ubuntu is started

To mount NTFS format partitions, You Need To NTFS-3g this software. It is short and powerful.
NTFS-3g is an open source software that supports reading and writing NTFS format partitions under windows. It is fast and secure. It supports windows
2000, XP, and 2003, and supports all POSIX-compliant disk operations.

First, edit sources. List.
# Sudo gedit/etc/APT/sources. List

Add Ubuntu drapper:
Deb http://givre.cabspace.com/ubuntu/ dapper main-all
Deb http://ntfs-3g.sitesweetsite.info/ubuntu/ dapper main-all
Deb http://flomertens.keo.in/ubuntu/ dapper main-all

Add 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

At the same time, you must import the GPG-key, which can be as follows:
# 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-

Update the source:
# Sudo aptitude update

Formal Installation

Run the following command under "terminal:
# Sudo apt-Get install ntfs-3g

Configure NTFS-3g

First, let's look at the partition types of some hard disk partitions.
# Sudo fdisk-l

Now you can modify
/Etc/fstab to automatically mount NTFS partitions when Ubuntu is started. But first back up this file:
# Sudo CP/etc/fstab. Bak

Create a mount point. For example, mount it to/Media/windows.
# Sudo mkdir/Media/Windows

Now you can add
/Dev/hda1/Media/ntfs-3g ults, locale = zh_cn.utf8 0 0
Modify according to your own situation.

Examples

Mount/dev/hda3
Add/dev/hda3/Media/Windows ntfs-3g Ro, locale = zh_cn.utf8, uid = 1000 0 0

About your locale

You can use the following command to view all locale
# Locale-

If you do not want to restart, you can
# Sudo umount-
# Sudo Mount-

The last command to mount the FAT partition
# Sudo Mount/dev/hda3/Media/Windows/-T vfat-O iocharset = utf8, umask = 000

Of course, you can add it in/etc/fstab.
/Dev/hda3/Media/Windows vfat iocharset = utf8, umask = 000 0 0

Openfire is automatically started with Ubuntu

Openfire is not started randomly by default. To solve the problem of manual startup every time, I wrote a script, which is placed in the/etc/init. d directory.
# Sudo Vim/etc/init. d/openfire
The content is as follows:

#! /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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.