LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   execute shell-scripts at kde startup (https://www.linuxquestions.org/questions/linux-newbie-8/execute-shell-scripts-at-kde-startup-371907/)

supersucker 10-11-2005 10:09 AM

execute shell-scripts at kde startup
 
hi,

how can i execute shell scripts when i log on to my fedora core 3 - system, i.e. when kde is started?

with applications, i just did a

ln -s /usr/bin/firefox

in the directory

~/.kde/Autostart

which works, but if i do the same with my shell-scripts, the script is not executed but opened in a text-editor when kde starts.

thx for help in advance

freakyg 10-11-2005 04:08 PM

In ~/.kde/Autostart, put something like this........
Code:

cd path/to/script ./<script>
OR
Code:

cd path/to/script sh script.sh

supersucker 10-11-2005 08:58 PM

aehhh,

how? ~/kde/Autostart is a directory and not a configfile...

should i write that to the .bashrc?

thx for help

JimBass 10-11-2005 11:37 PM

I usually just put symlinks in the autostart directory, and that works fine. Just make sure that the file being linked to is executable, and all should be good.

Code:

jim@musicbox:~$ ls -al .kde/Autostart/
total 4
drwx------  2 jim jim  136 2005-09-30 22:36 .
drwx------  4 jim jim  200 2005-09-29 00:48 ..
-rw-r--r--  1 jim jim 1605 2005-09-29 00:48 .directory
lrwxrwxrwx  1 jim jim  16 2005-09-30 22:36 konsole -> /usr/bin/konsole
lrwxrwxrwx  1 jim jim  21 2005-09-30 01:20 xscreensaver -> /usr/bin/xscreensave

Peace,
JimBass

BlackJackal 10-18-2005 05:03 PM

Alright I have done this on my system to a script located in /usr/bin but it still opens it up in a text editor.

JimBass 10-18-2005 07:38 PM

Could be any type of problem. Here are the 2 that I think are the most likely.

1) Is it executable? Most things in /usr/bin are, but if you put this there yourself, it may just have read, or read/write permissions. you can find out with
Code:

ls -al /usr/bin/(scriptname)
I won't go into how to interpret the info you get back in detail, but doing searches on permissions can help you. If you want this to be run, then most likely each possibile user (owner, group, and others) should have the ability to execute it. Another easy way to test:

Code:

/usr/bin/(scriptname)
If that executes the script, than permissions are most likely fine. If it doesn't execute, then your permissions are screwed up. That isn't 100% accurate, but is quick and easy.

2) Do you have the extension (if the script has one) associated with something else? I have seen Fedora Core boxes where when you try to download .rpm files, real player tries to play the .rpm as an audio file. If your script has some extension (.cgi, .exe, .*) you should check into that possibility.

Peace,
JimBass

BlackJackal 10-19-2005 08:39 AM

The permissions are -rwxrwxr-x.


One thing about this script is that when I view it in Nautilus it shows up as a text file not a script. How can it be changed from a text file to a script file?

BlackJackal 10-19-2005 09:15 AM

I have renamed the script to include a <.sh> on the end. Now the system sees it as a shell script but it still opens it up with a text editor.

jschiwal 10-23-2005 01:07 PM

Create a New -> "link to application" in the KDE context menu. Then select properties and change the name, set the working directory, and enter the script name in the execute dialog. Or press "browse" and find it that way. The main point is that there should be a <script-name>.desktop in the ~/.kde/Autostart/ directory, rather than a file link.

jrdioko 10-23-2005 01:34 PM

I don't use KDE, but couldn't you put something like "/path/to/script &" above the line to start KDE in your ~/.xinitrc?

etn 10-28-2005 10:47 AM

Hi, my answer to your question is:

ad the following line to your script:#!/bin/bash

so that it will look like this:


#!/bin/bash
your commands...


and as it was said, make it executable...

I hope this solves your problems, if you have not already solved them!


All times are GMT -5. The time now is 03:25 AM.