i bow to thee....

Status
Not open for further replies.

shan

Daemon Poster
Messages
1,364
i really want to make a small app in linux that does say, umm...
something like this... and i'll set a crond job for every hour or so.

run the uptime command
save the results say ( 01:12:01 up 13 days, 21:47, 3 users, load average: 0.41, 0.21, 0.12 (my current stats)) to a file called something.php
open a connection to my website.
upload the file.
close the connection
smile and have a pepsi.


any one know a simple way to complie this?
 
#!/bin/bash
uptime > something.php
ftp <address of server>
put something.php
quit
end

try something like this, your gonna have login issues with this and the ftp part, but its close.May have to add echo "loginname" and echo "passwd" after the ftp command, I think it will work, might not.
 
man, it's having some login issues, i've searched around but can find anything...hmm..maybe i'll just do it thru some gui type dealyo
 
oh yea...thanks for the help there man...

btw: it's not really login issues, it's more authentication issues...
 
ya somtime you can do it like this:

ftp user:passwd@ipaddress or ftp user:passwd@ftpservername

or another way may be to:
ftp server address
wait 10
echo "username" ------->need a linefeed here,cant rememberhow to do that
wait 10
echo "passwd"
wait 10
put filename.php

the wait can be adjusted that way if there's a delay with the server you still get logged on
 
ok after some screwing around I got it working

make a file called .netrc
machine ftpserver
login loginname
password yourpassword
macdef init
bin
prompt
put uptime.txt
close
bye

Then make a bash script:
#!/bin/bash
uptime > uptime.txt
FTP_PASSIVE_MODE=YES;export FTP_PASSIVE_MODE
echo "lets go"
ftp servername or address
echo "we are done"



Thats it, and it does work

make sure you put the .netrc file in the same path as the script and chmod it to 600-------> ie chmod 600 .netrc
make the script executable---> chmod +x scriptname

it works :)
 
well here's what i did, and i works just dandy :) ( i hadda put on some techno music and get my groove going )

#!/bin/sh
uptime > uptime.txt
users > users.txt
lftp -u user,pass beingbored.net<<EOF
cd public_html/system
put uptime.txt
put users.txt
quit
EOF
exit
 
Status
Not open for further replies.
Back
Top Bottom