Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

crontab & gnome-schedule do not run bash script

432 views
Skip to first unread message

Rajib Bandopadhyay

unread,
Sep 8, 2012, 11:43:02 AM9/8/12
to
Dear friends,
I have written a bash script as follows and saved it in my home folder. I tried using crontab & gnome-schedule I tried to run the script at a specified time. When I press the 'execute' button of gnome-schedule the script is running, however, it does not launches the script by itself at the specified time. Where am I going wrong?
In gnome-schedule command line I write (equivalently, in crontab -e, I write,45 20 * * * ~./testooo # JOB_ID_7):
testooo
-----------------------------------------
```````The script````````````````````````
-----------------------------------------
#!/bin/bash
#testooo.sh
# the file has been made executable
# cron saved in ~/.gnome/gnome-schedule/crontab
# gnome-schedule saved at ~/.gconf/apps/gnome-schedule/templates
#ooffice -writer %U>/dev/null 2>&1
ooffice -writer %U>/dev/null 2>&1
exit 0
-----------------------------------------
```````End of the script``````````````````
-----------------------------------------

Regards,
Rajib Bandopadhyay

Aragorn

unread,
Sep 8, 2012, 11:51:11 AM9/8/12
to
On Saturday 08 September 2012 17:43, Rajib Bandopadhyay conveyed the
following to comp.unix.shell...
cron uses a different environment from an interactive shell. You should
probably include the complete path to the ooffice executable in your
script.

--
= Aragorn =
(registered GNU/Linux user #223157)

Rajib Bandopadhyay

unread,
Sep 8, 2012, 12:50:25 PM9/8/12
to
Thanks for your prompt reply. Tried the option in the script file. Crontab reads the script file, but does not execute it. The edited script file:
---------------------------------------------------
#!/bin/bash
#testooo.sh

# cron saved in ~/.gnome/gnome-schedule/crontab
# gnome-schedule saved at ~/.gconf/apps/gnome-schedule/templates
# The following code works in terminal.
/usr/bin/ooffice -writer
exit 0

---------------------------------------------------
Please advise with the corrected code.
Regards,
Etc.

Aragorn

unread,
Sep 8, 2012, 1:21:54 PM9/8/12
to
On Saturday 08 September 2012 18:50, Rajib Bandopadhyay conveyed the
following to comp.unix.shell...

> Thanks for your prompt reply. Tried the option in the script file.
> Crontab reads the script file, but does not execute it. The edited
> script file: ---------------------------------------------------
> #!/bin/bash
> #testooo.sh
>
> # cron saved in ~/.gnome/gnome-schedule/crontab
> # gnome-schedule saved at ~/.gconf/apps/gnome-schedule/templates
> # The following code works in terminal.
> /usr/bin/ooffice -writer
> exit 0
>
> ---------------------------------------------------

Please do not top-post. Use interleaved replying and snip the
irrelevant parts from the quoted sections.

> Please advise with the corrected code.
> Regards,
> Etc.

At second glance, it is clear to me now why cron won't properly execute
your script. The executable you are invoking is OpenOffice Writer,
which is an X11 application. This means that it will only properly work
if $DISPLAY is set in the environment you are currently working from,
*and* if you are working from an X11 session.

GNU/Linux, like all UNIX-family operating systems, is a multi-user
platform. Users connect to the system via terminals or terminal
emulators. Your monitor, keyboard and mouse are part of the local
console, and this is only one of the many consoles/terminals supported.

cron has no way of knowing what terminal to send the output of
OpenOffice Writer to, and neither does Writer for that matter when it is
invoked from a cron-started script - for one, cron's environment is
distinctly minimalistic and the $DISPLAY variable won't be set - so I'm
guessing that ooffice simply fails because of that reason.

I could be wrong, but I believe that OpenOffice Writer does not support
being invoked in batch mode - i.e. as a tool which gets invoked, does a
certain task, and then terminates again, all without writing to stdout.
It is either way far too much of a heavyweight on the resources to be
used like that.

In addition to all that, cron jobs are normally executed with root
privileges unless otherwise specified, so even if cron starts a script
which resides in your home directory, this script would be running with
root privileges. You really don't want a hog like OpenOffice running
with root privileges. GNU/Linux also ignores the SUID bit on scripts,
so setting your own script SUID wouldn't work either.

Perhaps it would be better to tell us what you are trying to accomplish.
There's bound to be a far better way for whatever it is that you're
trying to do than doing it via cron.

Rajib Bandopadhyay

unread,
Sep 8, 2012, 1:53:34 PM9/8/12
to
On Saturday, September 8, 2012 10:51:55 PM UTC+5:30, Aragorn wrote:
>
> Please do not top-post. Use interleaved replying and snip the
>
> irrelevant parts from the quoted sections.
>
Point noted and followed.

> At second glance, it is clear to me now why cron won't properly execute
>
> your script. The executable you are invoking is OpenOffice Writer,
>
> which is an X11 application. This means that it will only properly work
>
> if $DISPLAY is set in the environment you are currently working from,
>
> *and* if you are working from an X11 session.

I know this from https://help.ubuntu.com/community/CronHowto#GUI_Applications, so I was using a script file to bypass the problem.
>
>
> I could be wrong, but I believe that OpenOffice Writer does not support
>
> being invoked in batch mode - i.e. as a tool which gets invoked, does a
>
> certain task, and then terminates again, all without writing to stdout.
>
> It is either way far too much of a heavyweight on the resources to be
>
> used like that.
>
Okay...
>
> In addition to all that, cron jobs are normally executed with root
>
> privileges unless otherwise specified, so even if cron starts a script
>
> which resides in your home directory, this script would be running with
>
> root privileges. You really don't want a hog like OpenOffice running
>
> with root privileges. GNU/Linux also ignores the SUID bit on scripts,
>
> so setting your own script SUID wouldn't work either.

Okay...
>
> Perhaps it would be better to tell us what you are trying to accomplish.
>
> There's bound to be a far better way for whatever it is that you're
>
> trying to do than doing it via cron.

Was trying to see whether it is possible to launch a GUI application with gnome-schedule.

Bit Twister

unread,
Sep 8, 2012, 2:01:30 PM9/8/12
to
On Sat, 08 Sep 2012 19:21:54 +0200, Aragorn wrote:
>
> At second glance, it is clear to me now why cron won't properly execute
> your script. The executable you are invoking is OpenOffice Writer,
> which is an X11 application. This means that it will only properly work
> if $DISPLAY is set in the environment you are currently working from,
> *and* if you are working from an X11 session.

Very true. I have root cron jobs, and user cron jobs.

root jobs create xmessage pop ups telling me about email and
whatnot. My user jobs will launch applications like ekiga (internet
phone/chat).

In any event the scripts executed in cron have the following test.

if [ -z "$DISPLAY" ] ; then
export DISPLAY=:0
fi

Those scripts will error out if I am not running a gui desktop
manager.

The above is not a good idea in a environment where there are
different users logged in.

Barry Margolin

unread,
Sep 8, 2012, 2:56:42 PM9/8/12
to
In article <slrnk4n1vq.f...@wb.home.test>,
They should also error out if they're not being run by the user who is
logged into the desktop, since $XAUTHORITY won't be correct.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Bit Twister

unread,
Sep 8, 2012, 3:54:06 PM9/8/12
to
On Sat, 08 Sep 2012 14:56:42 -0400, Barry Margolin wrote:
> In article <slrnk4n1vq.f...@wb.home.test>,
> Bit Twister <BitTw...@mouse-potato.com> wrote:
>>
>> In any event the scripts executed in cron have the following test.
>>
>> if [ -z "$DISPLAY" ] ; then
>> export DISPLAY=:0
>> fi
>>
>
> They should also error out if they're not being run by the user who is
> logged into the desktop, since $XAUTHORITY won't be correct.


Hmmmm, well I have a root cron job which will issue a

nohup xmessage -display :0.0 "some text here" &

That will pop up a message box in my user desktop. I click Ok and it
disappears.

This is a runlevel3 setup and root is not logged in.
$ cat /etc/release
Mageia release 2 (Official) for x86_64

FYI Aragorn:

Users can be enabled to submit cron jobs.
Those scripts will run with the user's privileges.

Rajib Bandopadhyay

unread,
Sep 8, 2012, 8:55:16 PM9/8/12
to
Friends, things are pretty quickly getting off my zone of comprehension. Maybe a few months from now I would be in a position to comprehend your discussion, but presently, I am a newbie.
So what should be my script, considering that I use Debian Squeeze 6.0.3 main contrib non-free repos?
Regards

Bit Twister

unread,
Sep 9, 2012, 1:18:02 AM9/9/12
to
On Sat, 8 Sep 2012 17:55:16 -0700 (PDT), Rajib Bandopadhyay wrote:

First, you may want to consider setting your Usenet application to
word wrap at about 60 characters to fall withing Usenet guidelines.

That extra space gets used for the reply depth indicators.

Some subject matter experts may not bother to reply to your post/problem
if they have to re-format it. :-(

> Friends, things are pretty quickly getting off my zone of
> comprehension.

Do not worry, you are being fed information piecemeal about little
things that can bite you when running in cron and some information
about what certain types of apps require as part of the basic setup.

> Maybe a few months from now I would be in a position
> to comprehend your discussion,

Heh, heh, but by then it will seem like you know even less. :)

> but presently, I am a newbie.

Well, doing a "locate bin/ | wc -l" on my Mageia Linux shows 5072 applications.
Rest assured I am pretty much a newbie also. :-D

> So
> what should be my script, considering that I use Debian Squeeze
> 6.0.3 main contrib non-free repos?

If you were to read http://www.catb.org/~esr/faqs/smart-questions.html ;
providing distribution and release enables subject matter experts to
provide more precise information/instructions. Depending on the
question, would not hurt to provide your Desktop manager name (Gnome,
KDE, LXDE, XFCE, Openbox, Enlightenment, Fvwm, Fluxbox, Window Maker,
IceWM, Blackbox, Afterstep, .....) and if you are running a 32 bit or
64 bit install.

As an example, you can compare what your interactive environment
contains with what your cron environment has. Put
env | sort > cron.env
in a cron script. Now run the command
env | sort > term.env
in a terminal. Once the cron job completes you can do a
diff -bBw cron.env term.env
to see what is different.

Lots of the stuff in term.env may not be required, but that will
depend on what application(s) you execute in the cron job/script.

You may want to place environment variables in a script and source it.
That allows you to have one place to make changes which all cron jobs
can use.

Example. I have a several scripts that I source to make my script
writing much easier. They reside in separate partition called
/local/bin. See:

$ cd /local/bin
$ ls -1 fun*
function_path_app
functions_change
functions_date
functions_flag_email
functions_install
functions_systemctl
function_stopwatch

My basic cron script would start out like:

#!/bin/bash
. /local/bin/function_path_app

That function has the basic PATH and any other variables I consider
necessary as a generic setup.

$ sort /local/bin/function_path_app | uniq | wc -l
23
shows that I have 23 lines of code. It is up to you what goes in your
setup scripts.

What I want to show you is my PATH setting in function_path_app
export PATH="\
/sbin:/usr/sbin:/usr/local/bin\
:/local/bin:/bin:/usr/bin:/usr/bin/X11\
:/usr/games:/usr/lib64/qt4/bin\
:$HOME/local/bin\
"

What is of intrest is /usr/lib64/qt4/bin

In particular is /lib64/. That is required on 64 bit installs. On 32
bit installs it would be /usr/lib/qt4/bin

How did I figure out what I needed there? you ask. It was easy. I did
a "echo $PATH" in a terminal and added it to function_path_app

Some java applications might want JAVA_HOME and CLASSPATH set.

Just for fun run this in a terminal.

env | sort | grep PATH

I do not have a Debian install handy so I can not tell you what to
ignore.

Add my
if [ -z "$DISPLAY" ] ; then
export DISPLAY=:0
fi

and those path variables you saw in tha above sort to your script.
Test/run your script in the terminal to prove it works, then run
the script in cron.

You may want to bookmark this url
http://tldp.org/LDP/abs/html/index.html

Aragorn

unread,
Sep 9, 2012, 1:31:38 AM9/9/12
to
On Saturday 08 September 2012 21:54, Bit Twister conveyed the following
to comp.unix.shell...

> FYI Aragorn:
>
> Users can be enabled to submit cron jobs.
> Those scripts will run with the user's privileges.

This I know, but why would anyone go through the trouble of using cron
to start OpenOffice? Using a scheduled start via "at" or perhaps an
automatic startup of OpenOffice via GNOME - similar to KDE's .Autostart
directory - is something I can understand. But cron is meant for
repetitive tasks, not for firing up something like OpenOffice
automatically.

Bit Twister

unread,
Sep 9, 2012, 2:24:26 AM9/9/12
to
I hear where you are coming from, but for this case "at" would not be
best in my opinion.

As for why. the OP could just be playing around trying to learn cron
scripting. On the other hand, maybe he is a tech writer, wants to get
to work early to surf the web and have cron launch OpenOffice at 8am
which tell him he needs to start doing what he is paid to do. :-8

Barry Margolin

unread,
Sep 9, 2012, 3:33:09 AM9/9/12
to
In article <slrnk4o9ka.i...@wb.home.test>,
Bit Twister <BitTw...@mouse-potato.com> wrote:

> First, you may want to consider setting your Usenet application to
> word wrap at about 60 characters to fall withing Usenet guidelines.

He's not using a Usenet application, he's using Google Groups. I doubt
it has an option like that.

Rajib Bandopadhyay

unread,
Sep 9, 2012, 12:49:39 PM9/9/12
to

> > First, you may want to consider setting your Usenet application to
>
> > word wrap at about 60 characters to fall withing Usenet guidelines.
>
>
>
> He's not using a Usenet application, he's using Google Groups. I doubt
>
> it has an option like that.

It's true, I almost fell off the chair when you talked about Usenet guidelines. I came to google groups via a highly convoluted route beginning in http://tldp.org/LDP/abs/html/

Rajib Bandopadhyay

unread,
Sep 9, 2012, 1:06:27 PM9/9/12
to
On Sunday, September 9, 2012 10:48:02 AM UTC+5:30, Bit Twister wrote:
>Depending on the
>question, would not hurt to provide your Desktop manager name (Gnome,
>KDE, LXDE, XFCE, Openbox, Enlightenment, Fvwm, Fluxbox, Window Maker,
>IceWM, Blackbox, Afterstep, .....) and if you are running a 32 bit or
>64 bit install.
...............
> I do not have a Debian install handy so I can not tell you what to
> ignore.
..............
I could send you the information about my system by attaching the output from "hardinfo".
That way, you could have all the information in an arranged manner. Well, you have given me more than a mouthful to chew, I will go through your email slowly and carefully, and will get back to you.
Regards

Bit Twister

unread,
Sep 9, 2012, 1:31:03 PM9/9/12
to
On Sun, 9 Sep 2012 10:06:27 -0700 (PDT), Rajib Bandopadhyay wrote:
> On Sunday, September 9, 2012 10:48:02 AM UTC+5:30, Bit Twister wrote:

>> I do not have a Debian install handy so I can not tell you what to
>> ignore.

> I could send you the information about my system by attaching the
> output from "hardinfo". That way, you could have all the
> information in an arranged manner.

This is not a hardware problem so we do not need hardinfo's output.

It is a problem with the biological unit between the keyboard and chair. :-D

I was talking about the results from the terminal output from the
env | sort results. :)

> Well, you have given me more than a mouthful to chew, I will go
> through your email slowly and carefully, and will get back to you.

Please get you G2 client app to wrap lines around about 60 characters, please.
Getting a bit tired of having to reformat your reply's. :(

PS: You might consider getting a free Usenet account. Due to all the
spam/troll posting via Google Groups, some subject matter experts
automatically kill file all posts from Google.

I use an account from http://www.eternal-september.org/

Rajib Bandopadhyay

unread,
Sep 9, 2012, 8:54:13 PM9/9/12
to
On Sunday, September 9, 2012 11:01:04 PM UTC+5:30, Bit Twister wrote:

> This is not a hardware problem so we do not need hardinfo's output.
> It is a problem with the biological unit between the keyboard and chair. :-D
> I was talking about the results from the terminal output from the
> env | sort results. :)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
user@debian:~$ env | sort
COLORTERM=gnome-terminal
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-tkThU7t88w,guid=dcf2b9ccd56f197cd12ca2e4000000e0
DESKTOP_SESSION=gnome
DISPLAY=:0.0
GDM_KEYBOARD_LAYOUT=us
GDM_LANG=en_IN
GDMSESSION=gnome
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GNOME_KEYRING_CONTROL=/tmp/keyring-IYdcXJ
GNOME_KEYRING_PID=2027
GPG_AGENT_INFO=/tmp/seahorse-8HjE3r/S.gpg-agent:2101:1
GTK_RC_FILES=/etc/gtk/gtkrc:/home/user/.gtkrc-1.2-gnome2
HOME=/home/user
LANG=en_IN
LANGUAGE=en_IN:en
LOGNAME=user
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
ORBIT_SOCKETDIR=/tmp/orbit-user
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
PWD=/home/user
SESSION_MANAGER=local/debian:@/tmp/.ICE-unix/2052,unix/debian:/tmp/.ICE-unix/2052
SHELL=/bin/bash
SHLVL=1
SSH_AGENT_PID=2087
SSH_AUTH_SOCK=/tmp/keyring-IYdcXJ/ssh
TERM=xterm
USERNAME=user
USER=user
_=/usr/bin/env
WINDOWID=62914976
WINDOWPATH=7
XAUTHORITY=/var/run/gdm3/auth-for-user-WpKx1s/database
XDG_DATA_DIRS=/usr/share/gnome:/usr/share/gdm/:/usr/local/share/:/usr/share/
XDG_SESSION_COOKIE=4fe5366f9ecbba1e5d678d220000000b-1347237379.702963-1947286203
user@debian:~$

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

> Please get you G2 client app to wrap lines around about 60 characters, please.
> Getting a bit tired of having to reformat your reply's. :(

I post via online google group page.
What is the specialty about 60 character
wrapping? I am not aware of most things
of the world, and this is one of them :-)
Seriously, I wish to know this.



> PS: You might consider getting a free Usenet account. Due to all the
> spam/troll posting via Google Groups, some subject matter experts
> automatically kill file all posts from Google.
> I use an account from http://www.eternal-september.org/

Point noted. But comp.unix.shell is a google group!
Am I missing something here?
Regards

Bit Twister

unread,
Sep 9, 2012, 10:43:00 PM9/9/12
to
On Sun, 9 Sep 2012 17:54:13 -0700 (PDT), Rajib Bandopadhyay wrote:
> On Sunday, September 9, 2012 11:01:04 PM UTC+5:30, Bit Twister wrote:
>
>> This is not a hardware problem so we do not need hardinfo's output.
>> It is a problem with the biological unit between the keyboard and chair. :-D
>> I was talking about the results from the terminal output from the
>> env | sort results. :)
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++

> DISPLAY=:0.0
> GDM_KEYBOARD_LAYOUT=us
> GDM_LANG=en_IN
> GTK_RC_FILES=/etc/gtk/gtkrc:/home/user/.gtkrc-1.2-gnome2
> LANG=en_IN
> LANGUAGE=en_IN:en
> PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> XDG_DATA_DIRS=/usr/share/gnome:/usr/share/gdm/:/usr/local/share/:/usr/share/

If I were you, exporting those variables in your cron script might it
run better.


>> Getting a bit tired of having to reformat your reply's. :(
>
> I post via online google group page.
> What is the specialty about 60 character
> wrapping?

Most terminal applications/screens are set 80 characters.
On Usenet, as different people reply, the left side of the line will
have reply/depth indicators. An example can be seen here
http://groups.google.com/group/alt.os.linux.mandriva/msg/fabb730cdb3912db
If you scroll down far enough you will find some reply's were 4 levels deep.

By the way, what you see there is what I would see with my Usenet client.

> I am not aware of most things
> of the world, and this is one of them :-)
> Seriously, I wish to know this.
>
>
>
>> PS: You might consider getting a free Usenet account. Due to all the
>> spam/troll posting via Google Groups, some subject matter experts
>> automatically kill file all posts from Google.
>> I use an account from http://www.eternal-september.org/
>
> Point noted. But comp.unix.shell is a google group!
> Am I missing something here?

Yup, comp.unix.shell is a Usenet group. Google just makes it look like
a google group. :-(

Rajib Bandopadhyay

unread,
Sep 10, 2012, 4:18:18 AM9/10/12
to
On Monday, September 10, 2012 8:13:01 AM UTC+5:30, Bit Twister wrote:

> > PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> > XDG_DATA_DIRS=/usr/share/gnome:/usr/share/gdm/:/usr/local/share/:/usr/share/
>
> If I were you, exporting those variables in your cron script might it
> run better.

Point noted.


> >> I use an account from http://www.eternal-september.org/

I have opened an account there, which offline client (if you do not use webform - I have not been able to find a way to go to the comp.unix.shell group from eternal-september) do you use?

I swear: as soon as I have switched over to the new access, your present irritation would be over. Maybe, the next one will be to answer my hows?
Regards

Aragorn

unread,
Sep 10, 2012, 4:28:36 AM9/10/12
to
On Monday 10 September 2012 10:18, Rajib Bandopadhyay conveyed the
following to comp.unix.shell...

> On Monday, September 10, 2012 8:13:01 AM UTC+5:30, Bit Twister wrote:
>
>> I use an account from http://www.eternal-september.org/
>
> I have opened an account there, which offline client (if you do not
> use webform - I have not been able to find a way to go to the
> comp.unix.shell group from eternal-september) do you use?

In your newsreader application of choice - I use KNode myself, which is
part of the KDE PIM suite - you must select the groups you wish to
monitor. This is called "subscribing", so it will be called that in the
menu of your newsreader application.

If you are doing this for the first time, and with active communication
going on between yourself and someone else, I would suggest first
checking out the latest messages, and after sending off your last reply
or reading the last pertinent message, then right-click on the group and
select "mark all as read". That way, you won't have to wander through
hundreds of articles per group, and upon the next time, your newsreader
will highlight only the new messages and/or hide the old ones.

Bit Twister

unread,
Sep 10, 2012, 4:58:18 AM9/10/12
to
On Mon, 10 Sep 2012 01:18:18 -0700 (PDT), Rajib Bandopadhyay wrote:

>
> I have opened an account there, which offline client (if you do not

Could be a terminology problem because there is a difference in my
head. :)

When I run my client, I have set it to use the news.eternal-september.org
server "On-line".

If I wanted to run "Off-line" I would setup my own
news server on my machine. It would then poll
news.eternal-september.org and send any reply's/posts I may have created.

> use webform - I have not been able to find a way to go to the
> comp.unix.shell group from eternal-september) do you use?

My Usenet client is slrn.
That would be a small challenge for a newbie to setup.

Since you are running the Gnome desktop manager, I'll suggest you use pan.

Rajib Bandopadhyay

unread,
Sep 10, 2012, 5:40:24 AM9/10/12
to
On Monday, September 10, 2012 2:28:22 PM UTC+5:30, Bit Twister wrote:
> > which offline client (if you do not...
> Could be a terminology
> problem because there is a difference in my head. :)

It is not in your head, I see what you mean.
I should've said desktop client, sorry!

>I'll suggest you use pan.
Thanks... And also, thanks, Aragorn. I would remember what you've said.
Regards

Rajib Kumar Bandopadhyay

unread,
Sep 29, 2012, 2:17:48 AM9/29/12
to
Dear friends,
The following queries were still to be answered. One highly empathic
person, who replied by email (I guess he wanted privacy) took great time
and patience to reply to my novice questions. When I asked him whether I
should post our communications to the group-list he said he wanted me to
do it in my own words.
However, I do not hope to surpass his wisdom with my mere acquaintance
with the issue, and that too at a superficial level. So I am posting our
lines in a logically arranged manner. The credit for lucidity goes
entirely to our anonymous friend.
Regards
RajibBandopadhyay
...
>>
>> Perhaps it would be better to tell us what you are trying to
accomplish.
>>
>> There's bound to be a far better way for whatever it is that you're
>>
>> trying to do than doing it via cron.
>
> Was trying to see whether it is possible to launch a GUI application
with gnome-schedule.

Just read this thread. It doesn't seem to me your question was ever
answered.
When you login to a linux system you take ownership of several things.
Among them are the "terminal lines" going to your keyboard and display.

What do you mean when you say, "Terminal lines", does it means the input-
output signals?

Before Linux (and before Microsoft and Apple :) there was an OS called
UNIX. It is still around in many flavors. Linux was closely modeled
after UNIX. In the late 60's when UNIX was starting you didn't work
with fancy graphics, only text, and the device with the keyboard
might not have a video screen, but a roll of paper. These devices
(paper printing and video) were called "terminals". The original ones
were known as "teletypes". They were physically plugged into a port
on the computer. Because the ports were used to connect to TeleTYpe
terminals, these ports came to be known as "tty lines". You can probably
still see their legacy in the device directory, try "ls /dev/tty*".
In a graphical environment text based windows typically emulate one of
those old terminals. Thus they have to connect to a "tty line". In
one of your terminal window run the tty command, it will report what
tty line your window is connected to. It is probably /dev/pty<xxx>
or maybe /dev/pts/<xxx>. The "p" in those device names stands for
"pseudo" because they mimic the physical ports with software.
When you login, and/or start a terminal window, you are given ownership
of the /dev/??? terminal line your window is using. When cron starts
one of your jobs it doesn't login and does not get a terminal line.
Thus it has no screen (window) to send output to and no connected
keyboard to get interactive input from.

If you login to a graphical environment many things about the window
manager and system are also setup and entered into your "environment".
Much of this is via shell variables you can see with the "env" command.
An important one is DISPLAY.

I have read the lines generated by the env command. Now, this looks like
there must be some files that are loading the environment similar to the
centralised Windows registry.
========================================================
My lines typically are:
========================================================
ORBIT_SOCKETDIR=/tmp/orbit-root
SSH_AGENT_PID=2799
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=d2950bc30d22ada616a24d3100000009-1348804879.438647-148187592
GTK_RC_FILES=/etc/gtk/gtkrc:/home/user/.gtkrc-1.2-gnome2
WINDOWID=102760451
GNOME_KEYRING_CONTROL=/tmp/keyring-7Brd7u
GTK_MODULES=gail:atk-bridge
USER=root
SSH_AUTH_SOCK=/tmp/keyring-7Brd7u/ssh
SESSION_MANAGER=local/Squeeze:@/tmp/.ICE-unix/2749,unix/Squeeze:/tmp/.ICE-
unix/2749
USERNAME=user
DESKTOP_SESSION=default
MAIL=/var/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/home/user
GDM_KEYBOARD_LAYOUT=us
LANG=en_IN
GNOME_KEYRING_PID=2249
GDM_LANG=en_IN
GDMSESSION=default
HOME=/root
SHLVL=2
LANGUAGE=en_IN:en
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=root
XDG_DATA_DIRS=/usr/share/gnome:/usr/share/gdm/:/usr/local/share/:/usr/
share/
WINDOWPATH=7
DISPLAY=:0.0
XAUTHORITY=/tmp/libgksu-27pE1G/.Xauthority
COLORTERM=gnome-terminal
_=/usr/bin/env
===========================================================
I am aware that there is no central registry in Linux.

On Linux, lets differentiate programs and processes. A program
is that thing you see on the disk, not loaded into memory, eg. /bin/ls.
A process is a running program. When a process is created it not only
receives the code from the disk program but also some "housekeeping"
information, eg. the identity of who is running this process, what
was the parent of this process, what files are open, etc. It also
receives an "environment", the stuff you see above. The new process
inherits the environment, and the open files, of its parent. Thus,
the child process can write to the same screen (window) as it parent,
and it can read the same stream of keyboard characters.

How do I know more about this, like interpreting the lines of codes
generated by 'env' above?

How do you interpret the entries in the windows registry?

HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\??\Volume{.....} REG_BINARY 70
2e 34 ...

Basically you don't. Some are fairly obvious (ex. LOGNAME=root),
others may be specific to some application. Some you read about
in a basic linux text (ex. PATH=...) while others may be specific
to an application (ex. SSH_AUTH_SOCKET=...) and you would read the
man pages and/or some text about the application (ssh in this case).

When a program runs from a crontab (gnome-schedule just eases the editing
of your crontab) that program runs "without logging in". It doesn't have
all the environment setup that a login session has. Because of this,
programs run by cron typically are not interactive. Consider that the
person at the keyboard and display when the program runs might not even
be you, or when that 4AM cronjob runs, what is the likelyhood that you
are sitting at your keyboard logged in? Does that mean interactive, or
GUI programs can not be run from cron? No, but it does mean that you
will have to recreate some of your logged-in environment and you may have
to take steps to ensure you are even available.

And in the end, does it mean that if I run a script in Crontab that
passes the precise environment a particular program needs, I could
theoretically make an application interactive?

You could do something like "cronjobcmd < /dev/pts/3 > /dev/pts/3"
and assuming you were logged in, and assuming ONE of your windows
was terminal line pts/3, you might be able to have an interactive
cronjob. But how do you know in advance whether you will be
logged in and using that terminal line?

Bit Twister

unread,
Sep 29, 2012, 3:25:33 AM9/29/12
to
On Sat, 29 Sep 2012 06:17:48 +0000 (UTC), Rajib Kumar Bandopadhyay wrote:
> Dear friends,

Hi. Glad you have fixed the nasty word wrap problem. :-D
Hope you are enjoying your Usenet client application. :)

>
> I have read the lines generated by the env command. Now, this looks like
> there must be some files that are loading the environment similar to the
> centralised Windows registry.
> ========================================================
> My lines typically are:
> ========================================================
> ORBIT_SOCKETDIR=/tmp/orbit-root
> SSH_AGENT_PID=2799
> TERM=xterm
> SHELL=/bin/bash

Yup, your basic login environment is created by executing
/etc/profile, /etc/bashrc, $HOME/.bash_profile and $HOME/.bashrc

Your desktop manager will then add whatever it likes.
Since you are running gnome, I can not help you since I run kde.


> How do I know more about this, like interpreting the lines of codes
> generated by 'env' above?

Not sure about what exactly you are asking. Those env variables just
contain values. Different programs act on the contents. Some used by
the shell, display manager, display system, current running process...


> When a program runs from a crontab (gnome-schedule just eases the editing
> of your crontab) that program runs "without logging in". It doesn't have
> all the environment setup that a login session has. Because of this,
> programs run by cron typically are not interactive.

That is correct. If you were to do a
cat /etc/crontab
you would see the basic environment variables set for the cron job.

> Consider that the
> person at the keyboard and display when the program runs might not even
> be you,

Very true, depending on what variables set you give them access to
your account. :(

> or when that 4AM cronjob runs, what is the likelyhood that you
> are sitting at your keyboard logged in?

Pretty good lately. :(

> Does that mean interactive, or
> GUI programs can not be run from cron? No, but it does mean that you
> will have to recreate some of your logged-in environment and you may have
> to take steps to ensure you are even available.

Very true. Script can parse the output from commands to decide what to
do. An example could be using ps to see if user is logged in and if
the key board locked program is not running then go ahead and launch
the app. Sorry, I do not know the name of that program.


> And in the end, does it mean that if I run a script in Crontab that
> passes the precise environment a particular program needs, I could
> theoretically make an application interactive?

Yes.


> You could do something like "cronjobcmd < /dev/pts/3 > /dev/pts/3"

That would be your basic poor design if cronjobcmd is the cron job/script.

> and assuming you were logged in, and assuming ONE of your windows
> was terminal line pts/3, you might be able to have an interactive
> cronjob. But how do you know in advance whether you will be
> logged in and using that terminal line?

You can't. Your script parses other application's output, sets the
required environment variables and launches the desired application.

I downloaded the latest distribution that you use but it would not run
as a guest in VirtualBox so I can not be sure this command works, but try
ps aux | grep $USER

PS: I can recommend that you create $HOME/.signature with your basic
setup in four lines or less, not counting the "dash dash space" first line. Example: if I were a newbie, it could
look like:
--
Mageia release 2 (Official) for x86_64
KDE 4.8.5
Linux 3.3.8-desktop-2.mga2




NOTE: The first line is a dash dash space

Once you have the file created, tell your Usenet client (Pan) about the
$HOME/.signature file and subscribe/post a message to a test group like
eternal-september.test or local.test
Then do a reply and see what your editor shows before posting a reply
to your test. :)


Rajib Kumar Bandopadhyay

unread,
Sep 29, 2012, 4:06:16 AM9/29/12
to
On Sat, 29 Sep 2012 07:25:33 +0000, Bit Twister wrote:

> Hi. Glad you have fixed the nasty word wrap problem. :-D Hope you are
> enjoying your Usenet client application. :)

I am indeed, thanks to you :) I am using Pan, as suggested

> PS: I can recommend that you create $HOME/.signature with your basic
> setup in four lines or less, not counting the "dash dash space" first
> line. Example: if I were a newbie, it could look like:
> --
> Mageia release 2 (Official) for x86_64 KDE 4.8.5
> Linux 3.3.8-desktop-2.mga2
.................
> NOTE: The first line is a dash dash space
>
> Once you have the file created, tell your Usenet client (Pan) about the
> $HOME/.signature file and subscribe/post a message to a test group like
> eternal-september.test or local.test
> Then do a reply and see what your editor shows before posting a reply to
> your test. :)

Why do I need a signature? Isn't the subject of my post obvious enough?

Janis Papanagnou

unread,
Sep 29, 2012, 4:21:00 AM9/29/12
to
The subject is a subject; helpful for an overview of the threads.
The contents of a posting should be complete, not relying on the
knowledge of the 'Subject:' header. The signature is not intended
for the subject but for your, well, signature. Indeed you don't
need a signature. If you have one, it should not contain more
than four lines of text, and it should be initiated with a line
containing just "-- " (dash, dash, blank); this convention makes
it possible for newsreaders to skip it when replying. (The rest
of the previous poster's notes are suggestions to test your
settings while not using this (or any other) topical newsgroup
as your test environment.)

Janis

Bit Twister

unread,
Sep 29, 2012, 4:43:57 AM9/29/12
to
On Sat, 29 Sep 2012 08:06:16 +0000 (UTC), Rajib Kumar Bandopadhyay wrote:

> Why do I need a signature?

You don't need it, but creating one with your distribution,
release/version, which desktop manager and what kernel is running may
help subject matter experts give you better answers on other problems.

With that type of signature file, it means less work for you and other
people's time wanting to help or recreate the problem without you having to
provide or them ask for the information.

> Isn't the subject of my post obvious enough?

It was a fine start for the thread, but the post did not have enough
information for me to get you any exact instructions or possibly
giving you exact data/instructions to solve the problem. :(

Different versions of distribution/desktop manager can have different
instructions/answers/commands for same problem. :(

PS:
If my distribution would not run as a VirtualBox guest I would change
distributions. :(

It is pretty nice to launch a guest and 12 seconds later be able to
mess around/experiment without screwing up the actual running
installation running on your machine.

That assumes your hardware has two gig or better ram and a reasonably
fast cpu and a bit of extra diskspace.

Speaking of which, maybe a .signature line like
AMD Athlon 64 Processor 3800+. 2 gig ram, 80 gig drive.
might help depending on the problem.

Janis Papanagnou

unread,
Sep 29, 2012, 4:54:07 AM9/29/12
to
On 29.09.2012 10:43, Bit Twister wrote:
> On Sat, 29 Sep 2012 08:06:16 +0000 (UTC), Rajib Kumar Bandopadhyay wrote:
>
>> Why do I need a signature?
>
> You don't need it, but creating one with your distribution,
> release/version, which desktop manager and what kernel is running may
> help subject matter experts give you better answers on other problems.

I suggest to put all relevant information in the body of the posting,
not in a signature.

Janis

> [...]


Bit Twister

unread,
Sep 29, 2012, 5:31:11 AM9/29/12
to
On Sat, 29 Sep 2012 10:54:07 +0200, Janis Papanagnou wrote:

> I suggest to put all relevant information in the body of the posting,

I agree that Gnome should have been in the body of the post.

> not in a signature.


I kinda know where you are coming from but putting my suggestions in a
sig file prevents the poster from omitting something "relevant" to the
problem which the poster may not know was relevant.

An example could be the problem only exists in a 64 bit install, but
does not happen on a 32 bit install.

Subject matter experts on 32 installs would be unable to work the
problem or worst, waste time troubleshooting the problem.

Then there is the case of a application problem only occuring on an
particular kernel. :(

I happen to run with 8 desktops in kde. A new release of kde broke
several of my scripts which had a command to switch to a desired
desktop before launching an application.

In that case it helps to know which version of the kde desktop manager is
running.

Janis Papanagnou

unread,
Sep 29, 2012, 6:26:09 AM9/29/12
to
So what? - Put all relevant information into the body.

Or are you seriously suggesting to maintain different signature files,
one for each newsgroup you are posting to?

Janis

Message has been deleted
Message has been deleted

Rajib Kumar Bandopadhyay

unread,
Sep 29, 2012, 7:09:43 AM9/29/12
to
On Sat, 29 Sep 2012 12:41:13 +0200, houghi wrote:

Guys, cool down. It is only a matter of signature. If you all wish I can
open a new topic on signature, like, should a post be accompanied with a
signature.

> You can edit your program and signature file to have the relevant
> information, the signature separator and your signature.
>
> You could even make it so that the information is only included in new
> messages or make an easy keystroke in your program/editor that will
> expand the information to whatever you desire e.g. when you type IMHWI
> your editor could extend it to whatever you desire. Depending on the
> editor, you can even point it to a file that has all the information.
>
> Extra points if it points to a piped file that gets the info from a
> shell script. That way you can include whatever you desire.
>
> Or you can just point to the script, file, piped file and include it.
>
> houghi

Can these indeed be done? How?



--
Linux 2.6.32-5-686-bigmem (i686); Compiled : #1 SMP Mon Oct 3
05:03:32 UTC 2011; C Library : GNU C Library version 2.11.3 (stable);
Default C Compiler : GNU C Compiler version 4.4.5 (Debian 4.4.5-8);
Distribution : Debian GNU/Linux 6.0.3; Squeeze; GNOME 2.30.2

Mirko K.

unread,
Sep 29, 2012, 7:16:40 AM9/29/12
to
On 29.09.2012 12:59, Rajib Kumar Bandopadhyay wrote:
> On Sat, 29 Sep 2012 12:41:13 +0200, houghi wrote:

>> Extra points if it points to a piped file that gets the info from a
>> shell script. That way you can include whatever you desire.
>>
>> Or you can just point to the script, file, piped file and include it.
>
> Can these indeed be done? How?

There are several methods. You can have a 1-minute cron job which
writes a new signature to your signature file.

Or you can use a FIFO special file, aka "named pipe". Try this
(requires fortune to be installed):

Open two terminal windows. In the first run:

mkfifo SIG_FIFO
while true; do fortune -a > SIG_FIFO ; done

Then, in the second terminal window, run:

cat SIG_FIFO

run it again, and again, ... Every time cat (or other programs) read
from the FIFO it gets a new fortune cookie.

Rajib Kumar Bandopadhyay

unread,
Sep 29, 2012, 7:26:39 AM9/29/12
to
On Sat, 29 Sep 2012 13:16:40 +0200, Mirko K. wrote:

> There are several methods. You can have a 1-minute cron job which writes
> a new signature to your signature file.
>
> Or you can use a FIFO special file, aka "named pipe". Try this (requires
> fortune to be installed):
>
> Open two terminal windows. In the first run:
>
> mkfifo SIG_FIFO
> while true; do fortune -a > SIG_FIFO ; done
>
> Then, in the second terminal window, run:
>
> cat SIG_FIFO
>
> run it again, and again, ... Every time cat (or other programs) read
> from the FIFO it gets a new fortune cookie.

My! My! Just for a signature? What is the practical utility of such a
process?

--
Linux 2.6.32-5-686-bigmem (i686); Compiled : #1 SMP Mon Oct 3 05:03:32 UTC
2011; C Library : GNU C Library version 2.11.3 (stable); Default C
Compiler : GNU C Compiler version 4.4.5 (Debian 4.4.5-8); Debian GNU/
Linux 6.0.3; Squeeze; GNOME 2.30.2

Mirko K.

unread,
Sep 29, 2012, 7:39:48 AM9/29/12
to
On 29.09.2012 13:26, Rajib Kumar Bandopadhyay wrote:
> On Sat, 29 Sep 2012 13:16:40 +0200, Mirko K. wrote:
>
>> There are several methods. You can have a 1-minute cron job which writes
>> a new signature to your signature file.
>>
>> Or you can use a FIFO special file, aka "named pipe". Try this (requires
>> fortune to be installed):
>>
>> Open two terminal windows. In the first run:
>>
>> mkfifo SIG_FIFO
>> while true; do fortune -a > SIG_FIFO ; done
>>
>> Then, in the second terminal window, run:
>>
>> cat SIG_FIFO
>>
>> run it again, and again, ... Every time cat (or other programs) read
>> from the FIFO it gets a new fortune cookie.
>
> My! My! Just for a signature? What is the practical utility of such a
> process?
>

I was just showing you how this could be done. I don't advice for or
against this, or having a signature at all (I also don't have one,
as you can see.) :-)

FIFOs are pretty cool stuff. You can imagine them as permanent pipes
with possibly multiple writer and reader processes. They allow
pretty complex inter-process communication.

Rajib Kumar Bandopadhyay

unread,
Sep 29, 2012, 7:42:54 AM9/29/12
to
On Sat, 29 Sep 2012 13:39:48 +0200, Mirko K. wrote:
> I was just showing you how this could be done. I don't advice for or
> against this, or having a signature at all (I also don't have one, as
> you can see.) :-)

I understand.

> FIFOs are pretty cool stuff. You can imagine them as permanent pipes
> with possibly multiple writer and reader processes. They allow pretty
> complex inter-process communication.

At present over my head. But I will keep tab to come back to this topic
in future when I am ready.
Let us end this thread then.

Bit Twister

unread,
Sep 29, 2012, 10:46:54 AM9/29/12
to
On Sat, 29 Sep 2012 11:09:43 +0000 (UTC), Rajib Kumar Bandopadhyay wrote:
> On Sat, 29 Sep 2012 12:41:13 +0200, houghi wrote:
>
> Guys, cool down. It is only a matter of signature. If you all wish I can
> open a new topic on signature, like, should a post be accompanied with a
> signature.

If you do, do not post in this Usenet group unless you are having a problem with
generating it. 8-)

FYI: the two middle lines are a bit much; contents from uname -sr could
replace the first three lines of text.

Bit Twister

unread,
Sep 29, 2012, 10:52:42 AM9/29/12
to
On Sat, 29 Sep 2012 12:26:09 +0200, Janis Papanagnou wrote:
>
> So what? - Put all relevant information into the body.
>
> Or are you seriously suggesting to maintain different signature files,
> one for each newsgroup you are posting to?

Not hardly. My suggestion was just provide a basic architecture, distribution
desktop manger, kernel with versions.

Per Rajib's request I'll stop with the .sig replies.

Chris F.A. Johnson

unread,
Sep 29, 2012, 11:04:15 AM9/29/12
to
On 2012-09-29, Janis Papanagnou wrote:
...
> Or are you seriously suggesting to maintain different signature files,
> one for each newsgroup you are posting to?

That's what I do, and slrn handles it automatically.

--
Chris F.A. Johnson, author <http://shell.cfajohnson.com/>
===================================================================
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)

Message has been deleted
0 new messages