Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




581 posts

Ultimate Geek


Topic # 107003 4-Aug-2012 17:05 Send private message

I'm running a headless ArchLinux server, access via SSH (putty on Windows).
I've got a small script that runs every minute, through crontab.  I know this works because I have it flashing an LED (through a simple C program).  I also want to display some text on a console when a user is logged in which is what I need some help with please.

The C program has a printf statement within it that succesfully outputs to the console when I run it manually, but when executed via the crontab scheduled script nothing shows up.

Similarly, including an echo command in the script shows nothing on a console that I have SSH'd into.

Is there anyway that I can tell the script to output everything to a specific user's console, or anywhere at all really where I can see it if I log in via SSH?





Create new topic

mjb

902 posts

Ultimate Geek

Trusted
Subscriber

  Reply # 667563 4-Aug-2012 18:34 Send private message

stdout for a cronjob is usually captured and emailed to the user account that owns the cronjob. If you have your mail system configured correctly, then you'll find the messages in the mailbox of your user account probably.

Anyway, to answer your question, try piping the output from your program to `wall`. something like so:

0 * * * * * /path/to/your/program | wall

wall stands for "write all", which will send a message to all logged in users. Check the manpage for more info.





contentsofsignaturemaysettleduringshipping



581 posts

Ultimate Geek


  Reply # 667570 4-Aug-2012 18:47 Send private message

Thanks MJB.

Unsure about the mail system configuration, it's the 'out-of-the-box' RaspberryPi ArchLinux image. Something else for this newby to learn about.

Will try the '|wall' pipe tomorrow (sports to watch and beer to drink tonight).

...and you're right, I must make more use of the manpages, although I don't find them all that 'beginner friendly'







581 posts

Ultimate Geek


  Reply # 667586 4-Aug-2012 19:33 Send private message

Decided to have a crack at it tonight, works a treat thank you.

Have learnt a bit now and I'll probably end up piping within the script rather than the crontab and using write instead of wall.





Create new topic



Twitter »
Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when new jobs are posted to our jobs board:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:




News »

Trending now »
Hot discussions in our forums right now:

Fecked up religious people strike again :-(
Created by Mark, last reply by joker97 on 24-May-2013 13:48 (56 replies)
Pages... 2 3 4


Cannabis is illegal yet we have really strong 'legal highs' ?
Created by qwerty7, last reply by freitasm on 23-May-2013 23:20 (74 replies)
Pages... 3 4 5


Xbox One
Created by DjShadow, last reply by Kingy on 24-May-2013 13:48 (68 replies)
Pages... 3 4 5


A new project coming to Geekzone
Created by freitasm, last reply by Technofreak on 24-May-2013 14:06 (322 replies)
Pages... 20 21 22


Troublesome transition to VDSL
Created by oseiler, last reply by michaelmurfy on 24-May-2013 13:57 (18 replies)
Pages... 2


HTC One (2013) owners' discussion
Created by Dingbatt, last reply by Lipex666 on 24-May-2013 11:23 (1556 replies)
Pages... 102 103 104


Orcon, Is this for real or a scam??
Created by old3eyes, last reply by DarthKermit on 22-May-2013 19:12 (29 replies)
Pages... 2


Vodafone Naked Broadband Speeds (Auckland CBD)
Created by wscalioni, last reply by grkiwi on 20-May-2013 21:13 (14 replies)


Geekzone Jobs »
Most recent NZ jobs in technology:

SQL DBA Consultant
Posted 24-May-2013 13:28

BI Developer
Posted 24-May-2013 13:28

SAP Netweaver Technical Consultant
Posted 24-May-2013 13:28

Senior BI Consultant
Posted 24-May-2013 13:28

Senior .Net Developer
Posted 24-May-2013 13:28

BI Consultant - Cognos
Posted 24-May-2013 13:28

Senior Data warehouse & BI Consultant
Posted 24-May-2013 13:28


Geekzone Live »
Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.