Did you know LQ has a Linux Hardware Compatibility List?
Go Back > Forums > Linux Forums > Linux - Distributions > MEPIS
User Name
MEPIS This forum is for the discussion of MEPIS Linux.


  Search this Thread
Old 03-13-2009, 08:19 AM   #1
LQ Newbie
Registered: Mar 2009
Posts: 2

Rep: Reputation: 0
Twittering my System Status

Good day all,

I am trying to get my system to twitter it's status to me.
I am just starting with system uptime at the moment, to try and get that working.

This is the script that I am using:
curl -u username:password -d status=$*
Then I set a cron job

*/10 * * * * /bin/sh /path/to/your/twitter/ My PC uptime is $(uptime)
Yet all I get is a bunch of
My PC uptime is

For those that want to see the tweets - check out skyegod on twitter

This is where I got the source for this code from.

If somebody could help I would really appreciate it

BTW - running Mepis 8.

Old 03-15-2009, 12:34 AM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954Reputation: 1954
First of all, I don't think the /bin/sh is needed, because the first line in the script already calls /bin/bash to run itself.

Second, it seems like putting the sent data in the cronjob command itself is a rather sloppy way to go about it. Why not include the uptime information in the script itself instead? You can use the function syntax, which will make it easier to modify or add other information in the future the same way.


function MYUPTIME {

echo "My PC uptime is: $(uptime)"


curl -u username:password -d status=$(MYUPTIME)
then your cronjob can be simply:

*/10 * * * * /path/to/your/twitter/

Edit: Come to think about it, the /bin/sh is probably there because it needs to run the $(uptime) command outside of the script. Moving uptime inside the script is what makes it unnecessary.

Last edited by David the H.; 03-15-2009 at 12:42 AM.
Old 03-16-2009, 08:10 AM   #3
LQ Newbie
Registered: Mar 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you -

I will give that a shot later when I get home.

Thanks again


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Twittering from the Command Line LXer Syndicated Linux News 0 05-22-2008 01:50 AM
Status of system, which commands decribes it the best ? sarajevo Linux - Server 2 08-08-2007 07:04 AM
Exit status of system command?? rmvinodh123 Programming 4 05-04-2007 11:15 AM
System status bar? mikegorb Linux - Software 4 12-13-2004 10:46 AM
System Status Spyiish Slackware 6 10-30-2004 02:00 AM

All times are GMT -5. The time now is 10:04 AM.

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