方法一是:
你用vi/etc/rc.local打开一个文件,然后在里边添加你要执行的可执行文件,要写绝对路径。
方法二是:
你先查看你计算机运行级别,打开vi/etc/inittab看里边id:2:initdefault:此系统运行级别为2,那么下一步你就要cd/etc/rc2.d目录下,把你要执行的可执行文件做一个连接到此处,而且在命名的时候要以大写S字母开头,S之后写的字符就是为了看你字符串的大小,大的排在前面执行。
另外在增加一个点:
此方法是为了让你的系统定时在什么时候自动执行,可以用以自动备份数据上!
你只要vi/etc/crontab或直接在命令行里输入crontab-e然后在里边添加一行,格式是这样的*****/usr/bin/updatedbupdatedb是一个可执行文件现提供以下资料:
Insteadofthefirstfivefields,oneofeightspecialstringsmayappear:
stringmeaning
-------------
@rebootRunonce,atstartup.
@yearlyRunonceayear,"0011*".
@annually(sameas@yearly)
@monthlyRunonceamonth,"001**".
@weeklyRunonceaweek,"00**0".
@dailyRunonceaday,"00***".
@midnight(sameas@daily)
@hourlyRunonceanhour,"0****".
EXAMPLECRONFILE
#use/bin/bashtoruncommands,insteadofthedefault/bin/sh
SHELL=/bin/bash
#mailanyoutputto‘paul’,nomatterwhosecrontabthisis
MAILTO=paul
#
#runfiveminutesaftermidnight,everyday
50***$HOME/bin/daily.job>>$HOME/tmp/out2>&1
#runat2:15pmonthefirstofeverymonth--outputmailedtopaul
15141**$HOME/bin/monthly
#runat10pmonweekdays,annoyJoe
022**1-5mail-s"It’s10pm"joe%Joe,%%Whereareyourkids?%
230-23/2***echo"run23minutesaftermidn,2am,4am...,everyday"
54**sunecho"runat5after4everysunday"
让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序让linux一开机就启动程序
阅读(868) | 评论(0) | 转发(0) |