简体   繁体   English

在openSUSE的启动上运行脚本

[英]Run script on Startup on openSUSE

Task : Run chromium on startup on openSUSE 任务 :在openSUSE上启动时运行chrome

So far: 至今:

First I don't know what path to take, it's possible with Cron or from rc.local. 首先,我不知道走什么路,可以用Cron或rc.local来实现。 I don't know which opinion is the best 我不知道哪种观点最好

Cron: Cron:

Figured out that it's not a very good idea 知道这不是一个好主意

rc.local rc.local

So I have this script: 所以我有这个脚本:

Fri Aug 11; 06:10:38; marton;/etc/init.d ;  $  cat /etc/init.d/chrom_start.sh 
#!/bin/bash
/usr/lib64/chromium/chromium
exit 0

I have permissions for the file: 我拥有该文件的权限:

Fri Aug 11; 06:11:09; marton;/etc/init.d ;  $  ls -l /etc/init.d/chrom_start.sh
-rwxrwxr-x 1 root root 48 Aug 11 06:10 /etc/init.d/chrom_start.sh

openSUSE doesn't have update-rc.d openSUSE没有update-rc.d

Fri Aug 11; 06:12:48; marton;/etc/init.d ;  $  update-rc.d
If 'update-rc.d' is not a typo you can use command-not-found to lookup the package that contains it, like this:
    cnf update-rc.d

I can't seem to find the example: 我似乎找不到该示例:

Fri Aug 11; 06:13:18; marton;/etc/init.d ;  $  cat /etc/init.d/skeleton
cat: /etc/init.d/skeleton: No such file or directory

Somewhere I found that I have to use install job but it does not exist 我发现必须使用安装作业,但它不存在

Fri Aug 11; 06:20:35; marton;/etc/init.d ;  $  %install
bash: fg: %install: no such job

So, if everything is alright, I just have to find a way to set the daemon to run on startup, what do I do next, considering that I don't have this skeleton file and these install job does not exist? 因此,如果一切正常,我只需要找到一种方法即可将守护程序设置为在启动时运行,考虑到我没有此框架文件并且这些安装作业不存在,下一步该怎么做?

I don't know if it'll be of help on OpenSUSE, but here is a thread about "how to autostart Chromium" : 我不知道这是否会对OpenSUSE有所帮助,但这是一个有关“如何自动启动Chromium”的主题:

https://raspberrypi.stackexchange.com/questions/38515/auto-start-chromium-on-raspbian-jessie-11-2015 https://raspberrypi.stackexchange.com/questions/38515/auto-start-chromium-on-raspbian-jessie-11-2015

This may help too. 这可能也有帮助。

If you are using bash (it is the most probable scenario) you could edit your .bash_profile file, or .bash_login (both should be in your user's home directory). 如果您正在使用bash(这是最可能的情况),则可以编辑.bash_profile文件或.bash_login (两者都应位于用户的主目录中)。

You need to add at the end your chromium's path like: 您需要在末尾添加铬的路径,例如:

/usr/bin/chromium&

the final & is to make it run as a background process. 最后的&是使其作为后台进程运行。 If you want to apply this change for every user you can edit your .bash_login file on /etc/skel 如果要对每个用户应用此更改,则可以在/etc/skel上编辑.bash_login文件。

Hope it helps, 希望能帮助到你,

ps. ps。 here is an url that may help a bit. 这是一个可能会有所帮助的网址。

http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM