Description:
-- HubBackup v1.0 in LUA5
-- Create a backup... a backup for your hub! Where will the backup be stored? --->> IN YOUR MAILBOX!
-- Created by TTB on 27 March 2006
-- For PtokaX 0.3.3.0 or higher
----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
--------------------------------------------------------------------
--[[
How does it work and what do we need?
You will be able to backup your entire hub with ONE command! You only need to set everything right. This package has all files included! What do we have:
A. Blat v2.5.0 w/GSS encryption (built : Sep 14 2005 22:46:29)? ---> More information can be found on www.blat.net
B. RAR 3.20 shareware version, rar.exe to pack your hub. ---> More information can be found on www.rarlab.com
C. The LUA file to call blat with your settings!
Blat is a program that will send the mail by DOS command line (cmd.exe). Of course we will add an attachment (the hub) when the backup will be made.
Now we need to config this... Plz go to the settings part.
Installation:
A. Extract the package in your scripts directory in your current hub.
B. Run the script in PtokaX.
NOTE: If the script doesn't work with error:? "cmail.txt does not exist" (in log file), then you need to copy your hub to a directory like c:\hub (not too much subdirs).
]]--
-- For your information, this is how Blat is used:
-- blat -install <smpt> <frommail> [-5 [- [- [- [- ]]]]]
-- blat <contentfile> -to <tomail> -f <frommail> -s "Subject" -server <smtp> -debug -log <logfile> -timestamp -attach <attachment>
You can download it here:? http://ptxscriptdb.psycho-chihuahua.net//download.php?view.221
Very nice script TTB, but is it possible to add authentication details (Login Name and password ) for Mailserver that require it?
Example:
2006.03.29 17:38:11 (Wed): The SMTP server does not like the name me@myhost.com.
Have you set the 'To:' field correctly, or do you need authorization (-u/-pw) ?
2
Quote from: Psycho_Chihuahua on 29 March, 2006, 17:42:45
Very nice script TTB, but is it possible to add authentication details (Login Name and password ) for Mailserver that require it?
Example:
2006.03.29 17:38:11 (Wed): The SMTP server does not like the name me@myhost.com.
Have you set the 'To:' field correctly, or do you need authorization (-u/-pw) ?
2
Very good question.... I will check this out! I'll post my answer on your question very soon!
Well, you need only 2 extra options, username and password. And of course if username and password then params=params.." -u "..username.." "-p "..password end :P
i had already though of that
i've been trying to do that for a while now....all i came up with ist
function TestCreateBatch()
local f = io.open("bmail.bat", "w")
f:write("call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- [-u [-pw ]]]]]\r\n"..
"cd hubbackup\r\n"..
"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp")
if username and password then params=params.." -u "..username.." "-pw "..password
end
f:close()
go = 10
end
which is of course - Wrong ::)
i come up with this error
\HubBackup.v.1.lua:243: attempt to concatenate global `params' (a nil value)
bastya can you tell me where i went wrong ;)
I don't know, this was just a generic thing. Haven't even seen the script. Would need to investigate whether blat can do encryption etc. and the way it accepts switches - I have no time for this right now.
No, the params I wroteare correct, just need to know how TTB uses them.
any progress on this?
I think i got it working with Authentification now :D
-- HubBackup v1.0 in LUA5
--------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------
-- Admin // Only the ADMIN can call the commands! --
aAdmin = "Psycho_Chihuahua"
-- Main --
bot = frmHub:GetHubBotName()
bprefix = "#"
bcmd = "mailmyhub"
tcmd = "mailtest"
hcmd = "mailhelp"
-- Connection --
cMailSMTP = "mailserver" -- Your SMTP adress, with standardport 25
cToMailAdress = "someone@somwhere.com" -- Your backup mailadres
cFromMailAdress = "me@myhost.com" -- Mailadress of the sender
-- Authentication --
AuthUser = "LoginUsername" -- Auth Username
AuthPass = "LoginPassword" -- Auth Password
-- Backup automaticly --
dAutobackup = "w" -- m = month // w = week // d = day // n = none
dTime = "3:30" -- Time. Example: 3:30 ; 19:00.
--FOR YOUR INFORMATION:
-- 1. Monthly backups will be done on the 1st of every month!
-- 2. Weekly backups will be done on every monday!
-- YOU ARE DONE NOW! Please run the script.
--------------------------------------------------------------------
-- Preloading
--------------------------------------------------------------------
function Main()
Today = os.date("%d")
frmHub:RegBot(bot)
SendToOps(bot, "HubMailer is ready to go!")
SetTimer(60000) -- every minute check
StartTimer()
end
--------------------------------------------------------------------
-- Timer
--------------------------------------------------------------------
function OnTimer()
if os.date("%d")~= Today then
Today = os.date("%d")
end
if dAutobackup == "m" then
if os.date("%d - %H:%M") == ("27 - "..dTime) then
SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
HubMail()
end
elseif dAutobackup == "w" then
if os.date("%a - %H:%M") == ("Mon - "..dTime) then
SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
HubMail()
end
elseif dAutobackup == "d" then
if os.date("%H:%M") == dTime then
SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
HubMail()
end
end
end
--------------------------------------------------------------------
-- ChatArrival for commands
--------------------------------------------------------------------
function ChatArrival(curUser,data)
data = string.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data,"%b<>%s+"..bprefix.."(%S+)")
if cmd and (curUser.sName == aAdmin) then
if string.lower(cmd) == bcmd then
HubMail(curUser)
return 1
elseif string.lower(cmd) == tcmd then
TestMail(curUser)
return 1
elseif string.lower(cmd) == hcmd then
HelpMail()
return 1
end
end
end
function HubMail()
Rarfile = "Hub.rar"
SendPmToNick(aAdmin, bot,"Creating hubbackup...")
SendPmToNick(aAdmin, bot,"Step 1: Creating cmail.txt in your hub folder -> It will be the text-content for your mail.")
CreateInfoText()
SendPmToNick(aAdmin, bot,"Step 1: Completed!")
SendPmToNick(aAdmin, bot,"Step 2: Creating bmail.bat (batchfile) in your hub folder -> The batchfile can pack (with RAR) and send (with Blat) your hub.")
CreateBatch()
SendPmToNick(aAdmin, bot,"Step 2: Completed!")
SendPmToNick(aAdmin, bot,"Step 3: Running the batchfile! -> YOUR HUB WILL NOW BE PACKED AND SEND BY MAIL!")
RunBatch()
SendPmToNick(aAdmin, bot,"Step 3: Completed!")
SendPmToNick(aAdmin, bot,"Step 4: Showing logfile and delete all temp files -> cmail.txt, bmail.txt, hub.rar, mail.log")
CallMailLog()
DelInfoText()
end
function TestMail()
SendPmToNick(aAdmin, bot,"Preparing testmail (text only, no attachments!) ...")
SendPmToNick(aAdmin, bot,"Step 1: Creating cmail.txt in your hub folder -> It will be the text-content for your mail.")
TestCreateInfoText()
SendPmToNick(aAdmin, bot,"Step 1: Completed!")
SendPmToNick(aAdmin, bot,"Step 2: Creating bmail.bat (batchfile) in your hub folder -> The batchfile can send (with Blat) your testmail.")
TestCreateBatch()
SendPmToNick(aAdmin, bot,"Step 2: Completed!")
SendPmToNick(aAdmin, bot,"Step 3: Running the batchfile! -> TESTMAIL WILL BE SEND!")
RunBatch()
SendPmToNick(aAdmin, bot,"Step 3: Completed!")
SendPmToNick(aAdmin, bot,"Step 4: Showing logfile and delete all temp files -> cmail.txt, bmail.txt, mail.log")
CallMailLog(aAdmin)
TestDelInfoText()
end
function HelpMail()
if dAutobackup == "m" then
dBackup = "Every month @ "..dTime..":00 on the 1st"
elseif dAutobackup == "w" then
dBackup = "Every week @ "..dTime..":00 on monday"
elseif dAutobackup == "d" then
dBackup = "Every day @ "..dTime..":00"
elseif dAutobackup == "n" then
dBackup = "None"
end
local HelpInfoForAdmin = ("\r\n\r\n"..
"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
"\t\t\t [ MAIL Help ]\t\t\t [ MAIL Help ] \r\n"..
"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
"\t\t"..bprefix..bcmd.."\t\t\t=\tSend hubbackup to mailadres\r\n"..
"\t\t"..bprefix..tcmd.."\t\t\t\t=\tSend testmail to mailadres\r\n"..
"\t\t"..bprefix..hcmd.."\t\t\t\t=\tThis menu\r\n"..
"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
"\t\tYour current settings:\r\n"..
"\t\tSMTP server\t\t\t=\t"..cMailSMTP.."\r\n"..
"\t\tBackup mail (receive adress)\t\t=\t"..cToMailAdress.."\r\n"..
"\t\tSend mail (sender)\t\t\t=\t"..cFromMailAdress.."\r\n"..
"\t\tAutomaticly backup\t\t=\t"..dBackup.."\r\n"..
"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n")
SendToNick(aAdmin,HelpInfoForAdmin)
end
--------------------------------------------------------------------
-- Creating DOS-files // execute DOS-files (CMD)
--------------------------------------------------------------------
function CreateInfoText()
local f = io.open("hubbackup\\cmail.txt", "w")
f:write("HubBackup has created a backup for you!\r\n\r\nCreated on: "..os.date("%a %d %b %Y @ %H:%M").."\r\nAttachment: "..Rarfile.."\r\n\r\nHubBackup by TTB.")
f:close()
end
function CreateBatch()
local f = io.open("bmail.bat", "w")
f:write("call hubbackup\\rar.exe a -r -y "..Rarfile.." ..\\*.*\r\n"..
"copy "..Rarfile.." hubbackup\r\n"..
"del "..Rarfile.."\r\n"..
"call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- ["..AuthUser.." ["..AuthPass.." ]]]]]\r\n"..
"cd hubbackup\r\n"..
"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -u "..AuthUser.." -pw "..AuthPass.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp -attach "..Rarfile)
f:close()
end
function RunBatch()
os.execute("bmail.bat")
end
function CallMailLog()
local handle = io.input("hubbackup\\mail.log", "r")
local info = nil
local line = ""
if handle then
for line in handle:lines() do
if info then
info = info.."\r\n"..line
else
info = line
end
end
if info == nil then
SendPmToNick(aAdmin, bot,"Sorry, no log found")
else
SendPmToNick(aAdmin, bot,"**** Here is your log file:\r\n"..info.."\r\n")
end
handle:close()
else
SendPmToNick(aAdmin, bot,"Sorry, no log found")
end
end
function DelInfoText()
os.execute("del bmail.bat")
os.execute("del hubbackup\\cmail.txt")
os.execute("del hubbackup\\"..Rarfile)
os.execute("del hubbackup\\mail.log")
end
function TestCreateInfoText()
local f = io.open("hubbackup\\cmail.txt", "w")
f:write("HubBackup created a TESTMAIL for you!\r\n\r\nCreated on: "..os.date("%a %d %b %Y @ %H:%M").."\r\n\r\nHubBackup by TTB.")
f:close()
end
function TestCreateBatch()
local f = io.open("bmail.bat", "w")
f:write("call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- ["..AuthUser.." ["..AuthPass.." ]]]]]\r\n"..
"cd hubbackup\r\n"..
"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -u "..AuthUser.." -pw "..AuthPass.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp")
f:close()
go = 10
end
function TestDelInfoText()
os.execute("del bmail.bat")
os.execute("del hubbackup\\cmail.txt")
os.execute("del hubbackup\\mail.log")
end
i got Auth working now and changed the script around a bit
New Stuff is:
- Settings now in settings.ini
- German and English Language Files
- Possible to turn User AUTH on or off
Quote from: Psycho_Chihuahua on 23 April, 2006, 12:29:29
i got Auth working now and changed the script around a bit
New Stuff is:
- Settings now in settings.ini
- German and English Language Files
- Possible to turn User AUTH on or off
-- Optimized a little
-- Made Lua5/5.1 compatible
-- Added OnError function
-- Bla Bla Bla... ;D
Nice ;D
i spoke too soon :(
it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment :'(
Even as a Master in my Hub i kept on getting
*** Error: You are not allowed to use this command!
from Profile based scripts
and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon :(
it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment :'(
Even as a Master in my Hub i kept on getting
*** Error: You are not allowed to use this command!
from Profile based scripts
and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
Could u give me the 1.3 ver. I formatted my hdd ;D
Here's the Bugger ;D
Quote from: Psycho_Chihuahua on 02 May, 2006, 19:09:37
Here's the Bugger ;D
HubBackup created a TESTMAIL for you!
Created on: Tue 02 May 2006 @ 22:16
HubBackup by TTB.
Everyhing works fine here... right click, etc...i revised the code an saw nothing wrong.
Edit--//
And now...
HubBackup has created a backup for you!
Created on: Tue 02 May 2006 @ 22:17
Attachment: Hub.rar
HubBackup by TTB.
Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon :(
it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment :'(
Even as a Master in my Hub i kept on getting
*** Error: You are not allowed to use this command!
from Profile based scripts
and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
i didn't say it doesnt work....i said it interfears with other profile based scripts like google bot or mutors getprofiles script as well as other scripts that are set on Profile basis.
Quote from: Psycho_Chihuahua on 02 May, 2006, 21:47:10
Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon :(
it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment :'(
Even as a Master in my Hub i kept on getting
*** Error: You are not allowed to use this command!
from Profile based scripts
and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
i didn't say it doesnt work....i said it interfears with other profile based scripts like google bot or mutors getprofiles script as well as other scripts that are set on Profile basis.
So...what do you purpose?
2006.05.04 00:42:27 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:42:27 (Thu): Error: Can't resolve hostname (tripsun1@walla.com).
2006.05.04 00:42:27 (Thu)-------------End of Session------------------
--------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------
-- Admin // Only the ADMIN can call the commands! --
aAdmin = "']['rIp?iN??uN"
-- Main --
bot = frmHub:GetHubBotName()
bcmd = "mailmyhub"
tcmd = "mailtest"
hcmd = "mailhelp"
-- Connection --
cMailSMTP = "tripsun1@walla.com" -- Your SMTP adress, with standardport 25
cToMailAdress = "tripsun1@walla.com" -- Your backup mailadres
cFromMailAdress = "tripsun1@walla.com" -- Mailadress of the sender
-- Authentication --
AuthStatus = "on"
AuthUser = "?uN"
AuthPass = "1111"
-- Backup automaticly --
dAutobackup = "w" -- m = month // w = week // d = day // n = none
dTime = "3:30" -- Time. Example: 3:30 ; 19:00.
LangFile = "Eng" -- for German inser Ger - otherwise the script is in english
y it's not work?
because this
cMailSMTP = "tripsun1@walla.com" -- Your SMTP adress, with standardport 25
is an email adress and not a mailserver ::)
try smtp.walla.com or mail.walla.com or something like that
and what is mailserver what i can use for this?
ohh ok tnx i check this now ;D
2006.05.04 00:52:57 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:53:18 (Thu): Error: Can't connect to server (timed out if winsock.dll error 10060)
2006.05.04 00:53:18 (Thu)-------------End of Session------------------
now i get this
Quote from: TrIp-iN-SuN on 03 May, 2006, 22:53:20
2006.05.04 00:52:57 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:53:18 (Thu): Error: Can't connect to server (timed out if winsock.dll error 10060)
2006.05.04 00:53:18 (Thu)-------------End of Session------------------
now i get this
Please RTFM before using a tool. :-)
Hi, where can I download the last version of the script please? (5.1)
New topics created cause the other was too old so I couldn't reply
Thx
See Markitos' post.
Nice... ppl still use it 8)
Yeah, and noticed that there is an 5.1 version, so moved to the finished section where it belongs. ;)
I don't know if I have abuse of gin or pot tonight, but I can't see a link in the Markitos's post.
And yes it will be use again TTB, because I'm bored with the corruption of files in my ptokax folder, this script is exactly what I need :)
Thx
Just scroll up a bit ;)
http://forum.ptokax.org/index.php?topic=5889#msg59447
http://forum.ptokax.org/index.php?action=dlattach;topic=5889.0;attach=73
Thx :)
People are talking about a 1.3 version, any luck to have a link for this one please?
The version that Bastya linked me is 1.21. Thx
http://forum.ptokax.org/index.php?action=dlattach;topic=5889.0;attach=78
Please be more thorough when reading. ;-)
the script works fine but it makes my other commans as owner not working run PtokaX DC Hub 0.3.5.2 med Robocop10,23 if i stopp the script all commands works get no wrong message in the script
Lito :D
I use now an external solution, (cobian backup 8) it's a free appz, works perfectly too :)
Put this as the last script in the list.
i put this script last still dosent work error in robocop
Lito :(
What error? The backup freezes a little time the hub... so have patients. When a os.execute runs, the hub waits till it has been closed (executable/batch).
when i put the script in my hub it makes my other commans as owner not working run PtokaX DC Hub 0.3.5.2 med Robocop10,23 if i stopp the script all commands works get no wrong message in the script when i turn the script off everything works normal cant use robocop when the i have the script in my hub
lito :)
Quote from: bastya_elvtars on 09 March, 2007, 21:41:39
Put this as the last script in the list.
as bastya has mentioned a couple of posts up, run the hubbackup script last. You can do that in the PtokaX UI from the Script Editor Tab
Quote from: Psycho_Chihuahua on 27 March, 2007, 15:47:58
as bastya has mentioned a couple of posts up, run the hubbackup script last. You can do that in the PtokaX UI from the Script Editor Tab
I am afraid this is a profile incompatibility problem.
anybody how can fix this Problem its a great script
Lito :)