egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is posible?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue May 03, 2016 7:50 am    Post subject: Is posible? Reply with quote

How I can do to make the bot save me a file that is accessible from the outside via IP : port , which can be read by another program ?

To be hosted on a VPS , share the IP with my web , but the web content is elsewhere (not in the VPS)
Is it possible? Mmm .....
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue May 03, 2016 8:31 am    Post subject: Re: Is posible? Reply with quote

juanamores wrote:
How I can do to make the bot save me a file ...


Go here:
http://forum.egghelp.org/viewtopic.php?t=6885
and read about how to write TCL that will write to a text file.

Quote:

... that is accessible from the outside via IP : port , ...


This would be handled by something else - not eggdrop itself.

Perhaps you would want some bash script, driven by crontab, to move the new file.

Quote:

...which can be read by another program ?


This depends on the permissions of the new directory and the permissions on the file.

Quote:

To be hosted on a VPS , share the IP with my web , but the web content is elsewhere (not in the VPS)
Is it possible? Mmm .....


Not exactly sure what you are asking here.
But if you are asking there is a way to copy this new file that Eggdrop has created for you, to another location somewhere on the web - then it is possible.

Google for bash scripts that automate ftp .

Here:
https://www.linux.com/blog/ftp-file-transfer-automated-bash-script
is a quick example.

Here:
http://serverfault.com/questions/279176/ftp-uploading-in-bash-script
is a bit more info on it.

And here:
http://www.stratigery.com/scripting.ftp.html

But you should research it more for yourself.

I hope this helps.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Wed May 04, 2016 3:10 pm    Post subject: Re: Is posible? Reply with quote

willyw wrote:

Perhaps you would want some bash script, driven by crontab, to move the new file.
...........
But if you are asking there is a way to copy this new file that Eggdrop has created for you, to another location somewhere on the web - then it is possible.

Google for bash scripts that automate ftp .
................


Thank you very much willyw, I think they are excellent ideas about the bash script added to a crontab.
I 'll work on it .
regards
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu May 05, 2016 2:11 am    Post subject: Reply with quote

You could also have a look at user's socket api - nonblocking tcp made easy topic where he shared some interesting things.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Fri May 06, 2016 12:13 am    Post subject: Reply with quote

Thanks caesar by your contribution, and I did work with a bash script , I have a problem with me crontab does not work with this script Confused
It's weird, because all crontabs works properly .
I used this example to the bash.
My crontab entry for this script is:
Code:
* */1 * * * /home/juan/mycode.sh >/dev/null 2>&1

Script doesn't run via crontab, but works fine standalone in the linux console with:
Code:
sh mycode.sh

I've tried other configurations without success for the moment ...
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri May 06, 2016 1:06 am    Post subject: Reply with quote

Try with add adding sh in front of the path like:
Code:

* */1 * * * sh /home/juan/mycode.sh > /dev/null 2>&1

_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Fri May 06, 2016 3:47 am    Post subject: Reply with quote

Neither it worked .
Can I see behavior this cron by console , to see bugs?
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri May 06, 2016 10:11 am    Post subject: Reply with quote

Try with:
Code:

0 * * * * sh /home/juan/mycode.sh > /dev/null 2>&1

You wanted a every hour execution, right?
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Fri May 06, 2016 10:22 am    Post subject: Reply with quote

It has to be every minute, this script checks the change songs on the radio .
The songs last more than a minute, but the DJ can change the song, so you should check minute a minute.

I try
Code:
 * * * * *
and
Code:
0-59 * * * *
and
Code:
1,2,3......59 * * * *
y don´t work.

But, you think the cron does not work for the short period of time?
I tried every 3 and every 5 minutes and it has not worked .
I think that is another problem ...
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri May 06, 2016 10:30 am    Post subject: Reply with quote

juanamores wrote:

...
Code:
* */1 * * * /home/juan/mycode.sh >/dev/null 2>&1



Quote:

...It has to be every minute, ...


Your line quoted first above, is not the standard way of doing 'every minute'.

Check out:
https://www.pantz.org/software/cron/croninfo.html

for an example of how to do it every minute.

I hope this helps.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Fri May 06, 2016 10:33 am    Post subject: Reply with quote

juanamores wrote:


I try
Code:
 * * * * *




This is the usual way of doing 'every minute'

I just noticed this post of yours now....
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri May 06, 2016 11:32 am    Post subject: Reply with quote

For every 1 minute shouldn't it be */1 * * * * ?
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat May 07, 2016 3:02 pm    Post subject: Reply with quote

Supposedly with the following code, puts the output of the commands into the log file "mylog", but is not stored in /var/log/mylog
Code:
* * * * * /home/juan/mycode.sh >>/var/log/mylog

Code:
[juan@vps804251 ~]$ cd /var/log
[juan@vps174886 log]$ pwd
/var/log
[juan@vps174886 log]$ find mylog
find: ‘mylog’: No such file or directory

With the "ls" command I do not see that file.
Conclusion: crontab does not run Rolling Eyes
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sat May 07, 2016 3:39 pm    Post subject: Reply with quote

juanamores wrote:

...
Conclusion: crontab does not run



Do something more simple to test if crontab is running.

Use nano to create a plain text file - in your home dir - with one line in it, like this:

Code:

date >> /home/your_name_here/somefilename


Use chmod to make this new file you have just created executable.
If you named the new file tempfile , it would be
chmod u+x tempfile

Check to be sure it is executable by viewing the list of files and permissions with:
ls -latr

Next:
add a line like this in crontab:
Code:

* * * * * /home/your_name_here/tempfile >/dev/null 2>&1

and save.

It will run once every minute.
(I just did this - that above line is copy-n-paste from my crontab, with one obvious edit - and it works.

It will write the date and time to the file named somefilename
in your home dir, every minute, on the minute.
It will be very easy to see if it is working. Smile
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sat May 07, 2016 4:15 pm    Post subject: Reply with quote

I had problems permission to record the file jajaja!

I could already record the log in my directory and I found something interesting ....
The crontab runs !
But , not upload nothing ....
The crontab log:
Quote:
local: live.txt remote: live.txt
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.

What worries me is this: You uploaded 0
Manually ejecution log:
Quote:
local: live.txt remote: live.txt
227 Entering Passive Mode (xxx,xxx,xx,xxx,227,44)
150 Accepted data connection
226-File successfully transferred
226 0.006 seconds (measured here), 4.62 Kbytes per second
28 bytes sent in 5,1e-05 secs (549,02 Kbytes/sec)
221-Goodbye. You uploaded 1 and downloaded 0 kbytes.
221 Logout.



New conclusion
: If the script execution is manually upload the file, if done through a crontab not upload.
Any suggestions ?
_________________
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber