Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using OpenSuSe 12.3

I want to create a link on my desktop for some specific terminal commands.

The background is that I do some backup via rsync and don't want to type the commands every time. I also don't want to use a cronjob, since my computer isn't running all the time.

The perfect solution would be a desktop icon, which on clicking executes the command(s).

Could somebody tell me how to do this?

share|improve this question
    
what is the question? –  Matt Clark Oct 26 '13 at 15:50
    
I want to know how to do this. –  Jakob Abfalter Oct 26 '13 at 15:51

1 Answer 1

up vote 3 down vote accepted

What you are asking for is called a shell script. In its simplest form, this is just a text file with a list of commands that will be run when the file is executed. For example, to run your rsync job, create a text file called rsync.bash on your desktop and add these lines to it:

#!/bin/bash

rsync source target

You will, obviously, need to replace that with the actual rsync command you want to run. Now, make the file executable:

chmod +x ~/Desktop/rsync.bash

You can now run the rsync command by double clicking the text file on your desktop. Depending on how your system is set up, you may be presented with this dialog when you double click:

enter image description here

Click on either Run or Run in terminal to execute the script. To run the file without having this dialog pop up, you will need to create a .desktop entry for it. Create a file on your desktop called rsync.desktop and add these lines to it:

[Desktop Entry]
Name=Run rsync 
Comment=Rsync script
Exec=/home/user/Desktop/rsync.bash
Icon=/home/user/myicon.gif
Terminal=false
Type=Application

It should now appear on your desktop using the icon /home/user/myicon.gif and you can run it by double clicking. If you want to do this for multiple scripts, standard practice is to create a $HOME/bin or $HOME/scripts directory, save all your scripts there, and create .desktop files calling each script. Just change the Exec line above to Exec=/home/user/scripts/rsync.bash

share|improve this answer
    
thanx for that helped me alot! –  Jakob Abfalter Oct 26 '13 at 16:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.