This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Is posible?

Help for those learning Tcl or writing their own scripts.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Is posible?

Post by juanamores »

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 :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Re: Is posible?

Post by willyw »

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.
... 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.
...which can be read by another program ?
This depends on the permissions of the new directory and the permissions on the file.
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-tra ... ash-script
is a quick example.

Here:
http://serverfault.com/questions/279176 ... ash-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 !
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Re: Is posible?

Post by juanamores »

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 :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

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 :?
It's weird, because all crontabs works properly .
I used this example to the bash.
My crontab entry for this script is:

Code: Select all

* */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: Select all

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 :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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

Code: Select all

* */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.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

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 :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Try with:

Code: Select all

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.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

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: Select all

 * * * * *
and

Code: Select all

0-59 * * * *
and

Code: Select all

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 :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

juanamores wrote: ...

Code: Select all

* */1 * * * /home/juan/mycode.sh >/dev/null 2>&1
...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 !
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

juanamores wrote:
I try

Code: Select all

 * * * * *

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 !
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

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: Select all

* * * * * /home/juan/mycode.sh >>/var/log/mylog

Code: Select all

[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 :roll:
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 :)
w
willyw
Revered One
Posts: 1197
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

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: Select all

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: Select all

* * * * * /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. :)
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

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:
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:
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 :)
Post Reply