LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2018, 09:16 AM   #1
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 401

Rep: Reputation: Disabled
Launch script at cinnamon login


Hi
I have created following script in: /home/user/bin/lockscreen.sh:
Code:
#!/bin/bash
cinnamon-screensaver-command -a
I want to execute this script at cinnamon login and for this purpose I have created file: /home/user/.config/autostart/lockscreen.sh
Code:
[Desktop Entry]
Type=Application
Exec=bash -c 'sleep 5; /home/user/bin/lockscreen.sh'
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_US]=lockscreen
Comment[en_US]=Locks session at login
X-GNOME-Autostart-Delay=0
But Cinnamon is not executing this script at login. Am I doing any mistake here? Kindly guide me.
Thanks
 
Old 12-26-2018, 09:48 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by zetrotrack000 View Post
I have created following script in: /home/user/bin/lockscreen.sh
Quote:
Originally Posted by zetrotrack000 View Post
Code:
I want to execute this script at  cinnamon login and for this purpose I have created file:  /home/user/.config/autostart/lockscreen.sh
Recheck where you put your script file. The desktop entry says one thing matching your first statement, but meanwhile there is this contradictory statement as to where the script file is actually located.


Or, are you saying that you have a .config/autostart file named the same thing as your script. Try not using the same name.


Shouldn't be harmful unless both are in your path variable, and they probably are not. But just a possible guess here.
 
Old 12-26-2018, 10:03 AM   #3
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 401

Original Poster
Rep: Reputation: Disabled
Kindly check the following results:
Code:
ls /home/user/bin/lockscreen.sh 
/home/user/bin/lockscreen.sh
and:
Code:
cat /home/user/.config/autostart/lockscreen.desktop |grep Exec
Exec=bash -c "sleep 5; /home/user/bin/lockscreen.sh"
Which show that file name is correct. However, still I have changed the filename to "autologin" and amend the script accordingly, but it's not working.
PS: Cinnamon "Startup Application" has an option to test the script and when I click on that option it executes the script properly, confirming that the script and its paths are correct.
 
Old 12-26-2018, 12:01 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Agree.

At this point I'd try to add logs to various parts of the process and see if they reveal anything. I know you can add logs to the script, however I'd also see if I could add logs to the desktop autostart process, if possible.

Also assuming the obvious which are that the lockscreen.desktop owner and permissions are the same as any other .desktop files which do run.

Same for the shell script, that it's permissions are at least 755.
 
Old 12-26-2018, 12:23 PM   #5
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 401

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Agree.

At this point I'd try to add logs to various parts of the process and see if they reveal anything. I know you can add logs to the script, however I'd also see if I could add logs to the desktop autostart process, if possible.

Also assuming the obvious which are that the lockscreen.desktop owner and permissions are the same as any other .desktop files which do run.

Same for the shell script, that it's permissions are at least 755.
Script permission wasn't 755, so I changed it to 755 but still not working. Regarding .desktop files, there are several files in ~/.config/autostart with different permissions:
Code:
-rwxr--r-- 1 user  1000 11065 Dec 24 20:16 firefox.desktop
-rwxr--r-- 1 user users   228 Dec 26 20:05 lockscreen.desktop
-rw-r--r-- 1 user users 15045 Dec 26 20:18 nemo.desktop
-rw-r--r-- 1 user users 14833 Dec 26 16:45 org.gnome.Terminal.desktop
-rw-r--r-- 1 user users  8001 Dec 26 16:45 print-applet.desktop
-rw-r--r-- 1 user users  5005 Dec 26 16:45 pulseaudio.desktop
-rwxr--r-- 1 user  1000  6961 Dec 24 20:16 thunderbird.desktop
-rwxrw-r-- 1 user  1000   610 Dec 24 20:16 whatsie.desktop
All run at startup, except lockscreen.desktop.
Regarding log, I don't know that how can I add log to a script.
 
Old 12-26-2018, 12:28 PM   #6
zetrotrack000
Member
 
Registered: Dec 2011
Posts: 401

Original Poster
Rep: Reputation: Disabled
One very strange thing is that when I click on "Run Button" in "Startup Applications" (check attached image), the script runs fine and loads screensaver. Doesn't it prove that the script formation, permission and location, all are correct?
Attached Thumbnails
Click image for larger version

Name:	startapps.png
Views:	129
Size:	54.3 KB
ID:	29296  
 
Old 12-26-2018, 12:52 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Not arguing the point, however it's not behaving as expected. Thus, debug as best as you can.

Me, I'd put in log outputs to a file within the script saying stuff like "Entered", "Successfully ran script", and so forth.

And I'd try to figure a way the desktop startup works where I could add debug to it. Perhaps there is a flag which can be used.
 
Old 12-26-2018, 12:54 PM   #8
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by zetrotrack000 View Post
Regarding log, I don't know that how can I add log to a script.
Code:
echo "this is a log line" >>  /home/xxx/yyy/logfile.txt;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Linux Mint 17 (Cinnamon) versus Linux Mint 17-1 (Cinnamon) Tikiman Linux - General 2 05-15-2015 02:54 PM
[SOLVED] How to get new widget themes to use on Cinnamon? (NOT Cinnamon nor Metacity themes!) jdackle Linux - Desktop 4 12-05-2014 09:39 AM
LXer: Try the New Makulu Cinnamon Debian Edition – Gaming-Ready, Cinnamon at Its Peak LXer Syndicated Linux News 0 10-28-2014 09:02 PM
LXer: Cinnamon 1.6 Will Bring Cinnamon 2D LXer Syndicated Linux News 0 09-05-2012 12:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration