Linux : what is the order of execution of *.desktop files in autostartup - linux

Need to launch two application on system startup.
A desktop file is created starting the fist one. Unfortunately could not find any way to launch the two application in single desktop file. If there is way please write in comments ?
As a workaround created the second desktop file for launching the second app.
Now Need to know the order of invoking *.desktop files in autostartup.
It that performed by alphabetical order ?
Regards,
Levon

You can always run script, which will then run your applications. For example:
#!/bin/bash
app1
app2
or, if you don't want to keep separate script, adding line Exec=app1;app2 to your .desktop file may do the trick.

Related

How to change directory (outside directory i.e. desktop) of file system in node.js

Hello I'm having difficulties in creating files in nodejs, when i try to create a file it only creates within the folder of my program. For example, I created test.txt then it will create on the program folder. what i want is to create a file outside the program folder. For example, I wanted to create test.text on desktop. is it possible?
I am using this:
app.use(express.static(path.join(__dirname, 'assets')));
Thanks
I believe if the purpose of this is to have backup of files, then you should rather run a basic script which will dump your files from your program location. You could always schedule it based on your choice of frequency.
It would be a much better approach instead of going out of your program folder just to create files. Not recommended!

Creating a menu item generically in Linux

For part of a large university project I have built a large java based application. To make "installation" cleaner I am aiming to write a script to copy the jar to a hidden file in the users home directory then add a menu &/Or desktop launcher.
Since I do not know what platform the markers shall be using it seems sensible to make this generic so I was going to build a shell script and a batch file.
The shell script starts off simple, check the directory doesnt already exist, make it and copy the file accross.
Then it comes to making a launcher of some kind. I presume each desktop environment shall do things differently.
After 10 minutes with google it seems everything suggested is autotools but since I have no knowledge of this it seems a bit overkill.
Is there an easy way to achieve what i need?
Thanks
These days, basically all of the desktop environments uses desktop files. For the specification for those files, see the Desktop Entry Specification.
Normally, they're put in /usr/share/applications on the system. Those files are then read and used to construct the menu.
If you have the ability to write to the system /usr/share/applications directory, that's obviously simplest, but if you had that, you would probably be putting the JAR file somewhere other than a hidden directory in the user's home directory.
If not, the path that's supposed to be honored is ~/.local/share/applications. If you drop a desktop file in there, it should show up for the user. (This is somewhat newer; I don't think GNOME 2 supports, it for example. Older desktop environments had various special places for these files.)
Then, the problem basically reduces to figuring out what to write for the Exec line in the desktop file. (See the desktop files on your system in /usr/share/applications for some examples.) If you're lucky, you can get away with just sticking a java command in there, but the details will depend on your application.

Where to store Cron Jobs, and will they always run?

I have thought of using cron jobs recently. In my site, I have css, js and images folders in my setup, which isn't very relevant, but might be needed.
I know how to do a cron job, but am unsure as to where to put it in my files so that it always runs every day.
So where should I put the cron job file, should I create a new folder for it and what should the file extension be?
Log in to your system via SSH, and then enter,
crontab -e
If this is your first time editing, it may ask you what editor you would like to use.
Then start editing.
*/1 * * * * /var/www/mysite/public/cron/script.php
Will run script.php every minute.
The cron I have installed on my Mythbuntu system keeps its daily cron scripts in /etc/cron.daily/.
File extensions don't matter on *nix. The file just needs to have executable permissions (and should have a shebang line at the top to state what program it should be run with).
anywhere, but I recommend outside web root. file extension to match the file type
Does not matter where you put it, as long as you call all included files by their absolute paths to avoid confusion. I've run into situations where
include '../../start.php';
had issues when running using the php command (usr/bin/php I think it was). Probably because it was running it from the different folder under which the php running command lies on the Apache server. So when including files I would use $_SERVER['DOCUMENT_ROOT'] as a reference point to include files.
alternatively you can always use the wget command to run it as if you are running it out of your own browser. Here's what I use:
wget http://www.mydomain.ca/cron/cron_whatever.php
And the timing can be set using the cPanel cron option, or you can write it out too.
And always have email notifications turned on to make sure you get the results written out to see if there's any issues.
You don't edit cron directly but rather run crontab -e which will effectively save allow you to edit and save it into a system area.
You can use SSH as described by guys before, but there is some hosting service providers who use cPanel and allows you to create those cron jobs easily via a web based interface easy to use and you will also easily make the correct time for run with them .

How do I launch an application from a .sh script?

Help me please with a bash script of a few lines.
I have a MyApplication executable in some folder, and I need to make a launcher script to call that application from it's folder when I click it from a grafical interface.
(I need this because I need my application to be launched from it's folder, so that Qt::currentPath() will return the current folder the executable is in)
Please help me, I just had to power off my linux machine two times in a row, I made fork bombs instead of launchers :(.
P.S. I'm a linux newbie, trying to figure out scripting.
EDIT
More about my current problem: Qt how to open a file in current dir ? or what's wrong with this?
Details: MyApplication is a GUI project compiled in Qt-Creator. It uses .xml files for storage. If I cd manually to the folder the executable is in, and run it, everything works fine, the application knows the path to the .xml files (current directory). But, if I just click the icon of the application it launches from $HOME, and my application is not able to find those .xml files.
That's why, I suppose, I need a .sh launcher, to call it from it's directory when I'll click it.
If its a graphical application, any sort of link will do. That works fine for me, unless you have something I'm not aware of, in which case please explain more.
Ps, fork bombs are limitable - http://forums.debian.net/viewtopic.php?f=10&t=44480&start=0

Running a Qt application at startup

I wrote a Qt application that is going to run on Linux. It supposed to run at startup.
It's supposed to run on every Linux- Suse, RedHat etc.
What script should I write and Where to put it?
I don't know how to write scripts at all, so I would appreciate it if you will attach an example.
You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory.
Any desktop entry file in that dir will get executed when a Window Manager starts up (see here).
To do this, usually you'll need to create your desktop entry file by hand (that's it, not via C++ code/script) and to just install in that directory via C++ code.

Resources