How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

May 18, 2012

How to start X program from cron

Filed under: Linux — Tags: , , , — admin @ 1:29 pm

Hello

Well today I have to make a little script that close a chromium erase the cache and start it again.

Bellow is the script


#!/bin/bash
ps aux|grep 'chromium-browser'|awk {'print $2'}|xargs kill -9
/bin/rm -rf /home/user/.cache/chromium
/bin/sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' /home/user/.config/chromium/Default/Preferences
DISPLAY=:0 /usr/bin/nohup /usr/bin/chromium-browser  &

If you will have something like

No protocol specified Can't open display :0

First of all check if you are runing the script as  user . Because if you are root won’t work.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress