Linux Knowledge II: Setting boot entry. Timed run the program

2010-11-12  来源:本站原创  分类:OS  人气:169 

Set boot service knowledge:
chkconfig - level 35 service name on: set the boot time of service.
/ Etc / at.allow and / etc / at.deny these two files to be carried out at the use restrictions. Some users want to have at it, that user's account will be written to / etc / at.deny can be! An account written line.
at [-m] TIME, make / var / spool / at directory under the actual operation of the work is, we must start our atd the services mentioned above, parameters:
-M: at work when completed, to notify the user that the email's work has been completed.
TIME: time format, where you can define 『when』 to conduct this work at the time, the format are:
HH: MM ex> 04:00
In today's HH: MM time for, if the time has exceeded, the future of HH: MM to make this work.
HH: MM YYYY-MM-DD ex> 04:00 2005-12-03
Mandatory for a certain period in one day to carry out the work of a special moment!
HH: MM [am | pm] [Month] [Date] ex> 04pm December 3
Is the same force in a certain period of time for a certain day!
HH: MM [am | pm] + number [minutes | hours | days | weeks]
ex> now + 5 minutes ex> 04pm + 3 days
That is, at some point 』『 together only for a few time.
Example one: in five minutes, will be / root / .bashrc to send dmtsai this user
[Root @ linux ~] # at now + 5 minutes
at> / bin / mail dmtsai-s "testing at job" </ root / .bashrc
at> <EOT> <== here to enter the [ctrl] + d will appear <EOF> words! On behalf of the end!
job 8 at 2005-09-07 10:47
# Information in the description above this line, the first 8 at the work carried out in 2005/09/07 to 10:47!
Example two: the computer room power outage is expected to 2005/09/16, 2005/09/15 23:00 I want to shut down?
[Root @ linux ~] # at 23:00 2005-09-15
at> / bin / sync
at> / bin / sync
at> / sbin / shutdown-h now
at> <EOT>
job 10 at 2005-09-15 23:00
# You to see! at work can also enter a number in a command it! Right!
atq: check how much above the current host at the Task Scheduler.
atrm [jobnumber]: exclusion scheduling, first with the atq view the schedule ID, and then excluded from the schedule this command.
chkconfig command is used to update and query the different services running on the system level, the syntax is:
chkconfig - list [name]
chkconfig - add name
chkconfig - del name
chkconfig [- level levels] name
chkconfig [- level levels] name.
chkconfig has five functions: to add services, remove services, list services, change the boot information and check the status of a particular service starts.
Options introduction:
- Level levels run level specified by the numbers 0 to 7 constitute the string, such as:
- Level 35 that specify the run level 3 and 5. To run level 3,4,5 in the nfs service outage, use the following command: chkconfig - level 345 nfs off
- Add name This option adds a new service, chkconfig to ensure that each class has a running start (S) or kill (K) entry. If missing, will be the default init script from automatically created.
- Del name to remove the service, and the related symbolic link from / etc / rc [0-6]. D deleted.
- List name list, if you specify the name you specified service name is displayed, otherwise, list all the services running on different levels of state.
Different operating levels are defined as follows:
# 0 - stop (Do not put initdefault is set to 0)
# 1 - Single user mode # s init s = init 1
# 2 - Multiuser, without NFS
# 3 - Full multi-user mode (standard operating level)
# 4 - unused # 5 - X11 multi-user graphical mode (xwindow)
# 6 - reboot (Do not set the initdefault 6)
Run-level files, each managed by chkconfig service needs under the corresponding init.d script with the two lines or more lines of comments.
The first line tells chkconfig to start the default run level and start and stop priority. If a service is not in any of the default run level starts, use - instead of run level.
The second line of the service description, you can use cross-bank notes.
For example, random.init contains three lines:
# Chkconfig: 2345 20 80
# Description: Saves and restores system entropy pool for
# Higher quality random number generation.
Show that the random script should be run level 2, 3, 4, 5, start, start priority 20 and stop priority of 80.
Example:
1, to install the apache service linux (compiled by downloading a binary file to install the economy, not the rpm package), apache service start command: / usr / local / apache / bin / apachectl start, so that apache service is running in run level 3 the following .
Command as follows:
1) touch / etc / rc.d / init.d / apache
vi / etc / rc.d / init.d / apache
chown-R root / etc / rc.d / init.d / apache
chmod 700 / etc / rc.d / init.d / apache
ln-s / etc / rc.d / init.d / apache / etc/rc.d/rc3.d/S60apache
# S is the start of the short, on behalf of start, K is the kill shorthand, representing close. Number represents the order of 60 starts (for iptv systems, many services built on the premise of the database before starting the normal start, and can be adjusted by the number of scripts on the boot sequence.)
apache's content:
#! / Bin / bash
# Start httpd service
/ Server / apache / bin / apachectl start.

Run Time Knowledge:
crontab: user settings, security issues, and at the same, we can restrict the use of crontab user account, allowed and prohibited uses and at similar. When you use Task Scheduler to create after the crontab, it will be recorded to / var / spool / cron / in.
crontab [-u username] [-l |-e |-r], parameters:
-U: only root can be carried out this task, that is to help other users to create / remove the crontab;
-E: edit the contents of crontab job
-L: access to the contents of crontab job
-R: remove crontab job content.
Example One: 12:00 every day with dmtsai sent letters to their
[Dmtsai @ linux ~] $ crontab-e
# At this time will enter the vi editor screen allows you to edit the work! Noted that each job is his party.
0 12 * * * mail dmtsai-s "at 12:00" </ home / dmtsai / .bashrc.
Minute hour date month representational figures range 0-59 weeks 0-231-311-12 0-7.
Represent the meaning special characters accepted on behalf of any meaning at all times! For example, one example of the table, that day, month, week are * to
*
『Represents both what month and what day of the week follow-up of several commands are executed at 12:00』 mean!
Representative of the meaning of separation in time. For example, if the work to be issued is 3:00 and 6:00, it will be:
0 3,6 * * * command
,
There are five columns, but the second column is 3,6, 3 and 6 are applicable to the representative!
Representatives within a period of time, for example, between 8 am to 12 points are 20 points per hour to conduct a public
- For:
20 8-12 * * * command
Carefully to see the second column into a 8-12 Oh! Are applicable to the meaning of the representative 8,9,10,11,12!
That n represents a number, that is, every n unit interval 』『 means, for example, once every five minutes, then:
* / 5 * * * * command
/ N
Very simple! With * and / 5 to match, you can also write 0-59/5, same meaning!
Time is running PHP files: 0 6 * * * / usr / local / php / bin / php / usr / local / apache / htdocs / test / timer.php>> / tmp / cron.log.
Running in the background: / usr / local / php / bin / php CopyBaseToFile.inc.php &.
Continue after the closure of the terminal running in the background: nohup / usr / local / php / bin / php CopyBaseToFile.inc.php &.

相关文章
  • Linux Knowledge II: Setting boot entry. Timed run the program 2010-11-12

    Set boot service knowledge: chkconfig - level 35 service name on: set the boot time of service. / Etc / at.allow and / etc / at.deny these two files to be carried out at the use restrictions. Some users want to have at it, that user's account will be

  • Troubleshooting the exam, linux system can not boot or error conditions that may occur 2011-03-10

    Troubleshooting the exam, linux system can not boot or error conditions that may occur Troubleshooting the RHCE exam, linux system can not boot or error conditions that may occur ############################################### # # ###################

  • Troubleshooting the RHCE exam, linux system can not boot or possible error conditions (change) 2010-03-19

    Troubleshooting the RHCE exam, linux system can not boot or possible error condition ############################################### # # ############################################### # # # # # Of: sheep ( [email protected] ) # # # Home: http://bluef

  • linux programs automatically start boot method 2011-05-19

    linux programs automatically start boot method 1) redhat startup mode and the execution order is: Load the kernel executing the program init / Etc / rc.d / rc.sysinit # first performed by the init script / Etc / rc.d / rc $ RUNLEVEL # $ RUNLEVEL the

  • Change the default boot entry GRUB 2010-09-14

    First posted my / boot / grub / menu.lst configuration file # Menu.lst - See: grub (8), info grub, update-grub (8) # Grub-install (8), grub-floppy (8), # Grub-md5-crypt, / usr / share / doc / grub # And / usr / share / doc / grub-doc /. # # Default n

  • Linux 2.6 kernel boot process analysis 2010-09-29

    Linux 2.6 kernel boot process analysis To an article on the Linux kernel compilation process, the next generation of the kernel this paper to introduce the Linux kernel boot process. In this paper, an example x86, x86 and embedded systems more than a

  • Reprinted: Linux's II hero-Alan Cox 2010-10-11

    Reprinted: Linux's II hero-Alan Cox Today, Linux open source with its unique charm is gradually popular. However, it appears before, who would think of a world-class operating system is distributed worldwide by thousands of developers created it with

  • Linux (Ubuntu) under the JNI entry 2010-11-06

    Although the powerful Java, but for the bottom or slightly less than some of the actions, this time only to make calls through JNI native methods to expand the Java program functions. Native methods can be declared in the analog interface for the Jav

  • Linux Knowledge VII: GCC.yum.rpm Detailed 2010-11-12

    GCC Installation | YUM Knowledge: yum install gcc: Online Installation | yum install gcc-g + + | yum install gcc-c + + | libstdc + +-devel gcc update for the corresponding c + + | libstdc package. yum check-update: check rpm package which can be upda

  • Add ubuntu boot entry 2011-06-12

    Add a boot entry: First copy the script or software to connect to the / etc / init.d / directory, then: update-rc.d xxx defaults NN command (NN for the boot sequence), add the script to initialize the execution queue.

  • ubuntu9.10 modify grub boot entry 2011-06-28

    1, the terminal type: cd / boot / grub, then type: sudo chmod + w grub.cfg (modify permissions, so that the file can be modified, otherwise your changes can not be saved) 2, change the type sudo vi grub.cfg ... .... # # # BEGIN the beginning, Modify

  • Close windows 2003 remote desktop run the program out of solution 2010-09-25

    Close windows 2003 remote desktop run the program out of solution Status: Remote Desktop to 2003, run a program, then close the remote desktop, after a period of time running was closed. Address: Start -> Run -> gpedit.msc Computer Configuration -&g

  • With the bat or sh file to run java program 2010-05-07

    Existing server.bat, server.sh, and the folder with the directory lib in the number of jar files Because often do not remember to write bat or sh file to run java program, this feature in order to check in here .... server.bat @echo off REM SET UP CL

  • Run the program in the background 2010-10-28

    1. Nohup command & Note: command is the command to run the program 2. Jobs see the program running in the background 3. Fg% n remove programs running in the background Note: n number of programs running in the background on behalf of

  • Linux boot entry changes 2011-06-14

    Install Red Hat Linux system, because of the installation is complete, the machine automatically back plate, forget to take disk, the system then automatically re-installed, so there is an immediate break off, causing the system at boot time, forming

  • Linux boot entry increase 2010-12-24

    Find / etc / rc.local Open the file with vim Add the following example: cd /opt/ACS_Server/bin/ sh startup.sh : Wq save out

  • Linux Knowledge IX: LAMP.phpMyAdmin installation. Configuration. Integration and use of Detailed 2010-11-12

    Linux system installation and use of bear in mind: 1, view the permissions are allowed. 2, see whether the subsidiary version of the corresponding software version. 3, the view directory services directory is corresponding with the operation. apache

  • Linux Knowledge Thirteen: Ubuntu command and use 2010-11-12

    Ubuntu knowledge: Show Desktop icon configuration: Press ALT-F2, enter gconf-editor, open the Configuration Editor, expand the branch: / apps / nautilus / desktop / be checked. Modify Resolution: [sudo] gedit / etc / default / grub, add the final sen

  • Linux Knowledge nine: LAMP.phpMyAdmin installation. Configuration and use of Detailed Integration 2010-11-12

    Linux system installation and use of remember: 1, view privileges are allowed. 2, check whether the version with the version of the software corresponding to the subsidiary. 3, view the directory services directory is corresponding with the operation

  • Linux, PHP used to achieve timing Crontab run <excerpt> 2010-08-24

    1. Written with PHP, shell getscore.php # #!/usr/local/bin/php -q # <? # $g_dbhost = "localhost"; # $g_dbname = "1bo8"; # $g_dbuserid = "root"; # $g_dbpasswd = ""; # function opendb(){ # global $g_dbhost, $g_dbus