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.




729 posts

Ultimate Geek
+1 received by user: 42


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

922 posts

Ultimate Geek
+1 received by user: 21

Trusted

  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



729 posts

Ultimate Geek
+1 received by user: 42


  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'







729 posts

Ultimate Geek
+1 received by user: 42


  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 tech item prices are listed in our price comparison site:




News »

Trending now »
Hot discussions in our forums right now:

MH 17 "shot down" all dead
Created by joker97, last reply by turnin on 22-Jul-2014 16:56 (196 replies)
Pages... 12 13 14


PB Computers experiences
Created by KiwiNZ, last reply by 1cloud on 23-Jul-2014 21:13 (30 replies)
Pages... 2


Geekzone giveaway: Thecus N2310 NAS
Created by freitasm, last reply by riahon on 24-Jul-2014 04:53 (48 replies)
Pages... 2 3 4


Huge Fuss, didn't even make it a year.
Created by networkn, last reply by Glassboy on 22-Jul-2014 19:50 (121 replies)
Pages... 7 8 9


Skinny's new aggressive ad campaign
Created by Yabanize, last reply by Yabanize on 22-Jul-2014 23:35 (52 replies)
Pages... 2 3 4


Is working in IT making you less manly?
Created by dotnetdev, last reply by k1wi on 24-Jul-2014 02:26 (23 replies)
Pages... 2


Problem with packet loss and ping on international traffic
Created by yankstar, last reply by yankstar on 23-Jul-2014 21:48 (11 replies)

Those were the days......Xtra Jetstream plans 10 yrs ago
Created by clinty, last reply by Jarsky on 23-Jul-2014 15:25 (35 replies)
Pages... 2 3



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.