English 中文(简体)
Ubuntu 自动启动应用程序
原标题:autolaunch of application in ubuntu

我创建了脚本文件 -

#!/bin/sh
echo "my application is here"
./helloworld  # helloworld is our application
  1. after creating the script file i copied it in init.d
  2. I gave the command chmod +x /etc/init.d/vcc_app (vcc_app is the name of script which I have created)
  3. Then I gave the command ln -s /etc/init.d/vcc_app /etc/rc.d/vcc_app (rc.d is the run level directory)

但当我重开董事会时 我的申请书不是自动执行的 有人能帮我吗?

问题回答

/etc/init.d 中的脚本必须是>LSB-compact

如果您只想自动运行启动进程结尾处的命令, 请尝试将其放置在 / etc/ rc. local 中 。

并非所有的Linux系统都使用相同的 init daemon (ubuntu 使用启动功能: < a href="http://upstart.ubuntu.com/getting-started.html" rel=“nofollow” >http://upstart.ubuntu.com/getting-started.html ),但它们在脚本中都使用 start 。 其他常见功能是 stat restart , 但同样没有跨局标准的真实性。

!#/bin/sh

start () {
    echo "application started";
    ./helloworld  # you should use an absolute path here instead of ./
}

stop () {

}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    *)
        echo "Usage start|stop";
esac

exit $?

最后一位是一个基于第一个命令行参数的开关, 因为开关将引用脚本 < code> myrcstatic start

为了使用 stop () () ) (以及经常有用的 restart () ),你需要保持或能够获得由 start () 启动() 启动的进程的频度;有时使用/tmp 中的小“pid 文件”(包含启动时创建的pid、eg、 /tmp/myscript.pt 的文本文件)。

Ubuntu 上所用的“ 启动” Init 守护进程有其自身的特性, 但除非需要使用,





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签