RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER
I have a PHP script which includes the Zend framework Mail.php for sending mails.
I am running a WAMP server and i used DW to create it.
I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
Please help its really urgent.
Thanks for your response.
bat file has:
path of the php.exe -f path of php file.
But when it runs it gives an error that the zend framework file not found.
I have a seperate PHP includes folder under which zend FW is stored.
That folder is marked in includes_paths in php.ini.
Similar Messages
-
Run .sh script with Java, then change window position
Is the following possible?:
From java, run a .sh script, which opens a total of 4 windows. (I know how to do this part).
Once the 4 windows (or more) are opened, I want to position them in specific locations on the screen. Is this possible, since the .sh script actually opens the windows?. Use the setLocation method in java.awt.Component??
any help is appreciated.
thxAs I recall, -geometry can have 4 numbers, I think it was {width}x{height}+{X location}+{Y location}, for example "-geometry 400x300+20+20". The + signs can be - signs if you want to count from the right or bottom margins.
Yeah, here's a quote from "man X":
most X programs accept a command line argument of
the form -geometry WIDTHxHEIGHT+XOFF+YOFF (where WIDTH, HEIGHT, XOFF,
and YOFF are numbers) for specifying a preferred size and location for
this application's main window.
Check out the man page for more details. -
is anyone experiencing problems with opening mission control from the desktop. Running mountain lion with parallels 7 and windows 7
I had been having a similar problem on Lion with Safari pdf files despite downloading the latest Adobe Reader XI.
I would constantly get the same messages - There was an error opening this document. The file is damaged and could not be repaired. And I would get a blank page when I tried to print the pdf if I tried printing from the Safari web page using File - Print from the top toolbar on my laptop.
Then I came across the grey Safari lozenge with action icons.
This allowed me, without downloading the pdf, to print the pdf file direct from the Safari page by using the Print icon on the grey lozenge that appears centrally three quarters down the screen.
Then I discovered that if I save the pdf using the Save icon from this same grey lozenge on the Safari page I can open and print this pdf version from my desktop.
I've tested it with a couple of different pdf files and these methods work using the grey lozenge icons but the same pdfs files don't work using File - Save As on the Tool Bar. -
VBS objshell.AppActivate doesn't work with Windows Task Scheduler
Hi all,
This script do the following :
Open Adobe Flash media Live Encoder with an encoding profile
Activate the Adobe Flash... Window
Send enter key to start encoding
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run """C:\Program Files (x86)\Adobe\Flash Media Live Encoder 3.2\FlashMediaLiveEncoder.exe"" /p ""C:\Users\process\AppData\Roaming\Adobe\Flash Media Live Encoder 3.2\profile.xml"""
'Loading time
WScript.Sleep 5000
objshell.AppActivate ("Adobe Flash Media Live Encoder 3.2")
WScript.Sleep 5000
objShell.SendKeys "{ENTER}" 'start encoding
This script perfectly works manually, but the objshell.appactivate command doesn't work when i run it with the windows task Scheduler.
Any ideas ? ThxHi to all! I have found workaround for this issue - I wrote vbs, made run it via bat file, and converted the bat file to exe
vbs
Set oShell = CreateObject("WScript.Shell")
If oShell.AppActivate ("Connecting error to Bee") Then
WScript.Sleep 2000
oShell.SendKeys "%{F4}"
End If
bat
start C:\Users\User\Desktop\close.vbs
bat to exe
Advanced BAT to EXE Converter v2.83
I know it's some weird solution but it is working with Win Task Scheduler correctly. Try it ;)
In some cases you need to mark checkbox "run this program as an administrator" and (or not) disable UAC. -
Issues with Windows TasK Scheduler
Hi!
I'm having two issues recently with Windows Task Scheduler, and I'm wondering if anyone else has experienced this and know of a resolution. We are on Windows Vista.
Error value 2147750687 - The task we are using has been running successfully since day one, all of a sudden, two concurrent jobs got triggered the other day, thus one of them failed and gave us this error. Why would the scheduler kick off two jobs start at the same time? How can that happen? The settings are "run with the highest privileges" and run whether user is logged on or not".
Error value 2147549186 - On this one, the task was running as scheduled, no errors in the log, then all of the sudden, after 10 minutes into the job, it re-started “due to a failure”. The settings are set to restart after 5 minutes, 3 attempts, but since it was running, and our logs do not identify any issues, what could have caused the scheduler to think there was an error?
JoeHi LordTim,
>>However, I cannot get Access to load<<
How did you load the Access? Did you use Access object to automate the Access applicaiton?
If I understood correctly, did Access load successfully when you in a normal script?
If yes, I think the issue may relative to the Task Scheduler. I suggest that you get more effective response from
Windows Community forum about Task Scheduler issue.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
We have a .vbs script that reads a source text file, looks for errors, performs a find/replace and then writes a cleaned version of the file to a destination folder.
When executing the script by manually double clicking on the .vbs file, the script works flawlessly. But when executing via Windows Task Scheduler using Cscript.exe, it creates an empty, zero byte, text file. Task Scheduler is set to run
"C:\Windows\System32\cscript.exe" with the Add arguments (optional): C:\Scripts\myscript.vbs.
Does anyone know of a way to make it work using the Windows Task Scheduler?
Part of the Script:
Sub CheckFilesIntegrity()
Dim cleanedfile,strLine,outputStr, tempstr, tmpChar, changeTo, companycode, storestring
Dim ObjFileSys, objFile,objCleanFile
charArray = Array("-","?", "/", "\", ":", "*", """", "<", ">", ",", "&", "#", "~", "%", "{",
"}", "+", "_", ".", "a", "e", "o", "s", "h","i","E", "O","P", "S", "p", "=")
Set ObjFileSys = CreateObject("Scripting.FileSystemObject")
Set objCleanFile = CreateObject("Scripting.FileSystemObject")
Set objFile = ObjFileSys.OpenTextFile(file.name, ForReading, True)
textfilename = destinationpath & objfilesys.GetBaseName(file) & ".txt"
Set cleanedfile = objCleanFile.OpenTextFile(textfilename, ForWriting, True)
ObjLog.writeline "File containing cleaned up data: " & textfilename
Do while not objfile.AtEndOfStream
strLine = objfile.ReadLine()
tempstr = strLine
If (Left(UCase(tempStr),8) <> "HPAYMENT") Then
'fix pay now data entry whre record does not have a company code
If Mid(tempstr, 18,3) = "000" Then
companycode = Mid(tempstr,32,3)
storestring = Left(tempstr,17)
tempstr =Replace(tempstr,"000",companycode,18,1,1)
tempstr = storestring & tempstr
storestring = Left(tempstr,31)
tempstr= Replace(tempstr,companycode,"000",32,1,1)
tempstr = storestring & tempstr
End If
'remove invalid characters and replace them with zero (filler)
For Each tmpChar in charArray
Select Case tmpChar
Case "-","?", "/", "\", ":", "*", """", "<", ">", ",", "&", "#", "~", "%",
"{", "}", "+", "_", ".", "a", "e", "o", "s", "h","i","E", "O","P", "S", "p", "="
changeTo = "0"
outputStr = replace( tempstr, tmpChar, changeTo,1,-1,1 )
End Select
tempstr=outputstr
Next
Else
outputStr = tempstr
End If
strLine = outputStr
cleanedfile.writeline(strLine)
Loop
cleanedfile.Close
Set cleanedfile = Nothing
Set ObjFileSys = Nothing
Set objFile = Nothing
ObjLog.writeline " Completed processing of file: " & textfilename
End SubSo we ended up getting it to work by replicating the double click function. Meaning that we created a Batch file that calls the .vbs script, then had Windows Task Scheduler run the Batch file. In that way all necessary permissions were passed
through from one environment to another, which was failing when we called the .vbs script using CScript. -
Windows task scheduler to run batch file running a java program
I have created a batch file that runs my SendEmail program. The batch file is in the same directory as the java program. The only line in the batch file is
java SendEmail
This works fine from the command prompt but from the windows task scheduler it fails to function. Any help on how I can overcome this problem will be greatly appreciated.
THanksLooks okay. The classpath is set, too, I guess? Btw, try running javaw instead of java. I may err, but I think it can show a console, so you can watch any error messages.
-
Windows Task Scheduler executing old triggers even after recreating the task
I had this task working perfectly until I changed the schedule. After I changed the scheduled time 5 minutes earlier, I noticed that in the history, it still triggers the old schedule. I tried restarting the server, deleting the task and recreating it even
without a trigger and it's still executing the task with the old trigger. The attached screenshot shows that the task doesn't have a trigger but as you can see in the history it's still trying to execute the task. How does the Windows Task Scheduler work?
Is there a file or database that I can purge the old task?
I also tried applying this hotfix but it didn't seem to fix the issue:
http://support.microsoft.com/kb/2461249
NOTE: This is Windows 2008 R2 and the Error message in the history is: Task Scheduler failed to start "<the
name of my task>" task for user "<the
user>". Additional Data: Error Value: 2147750689.Since batch job can be run manually without error, cmd.exe is not the problem.
I researched and found that the problem may be due to exhausted desktop heap and the solution is to increase the value.
Please try this step:
1. restart the server first and test again (a simple solution that may work)
2. if the first attempt fail, take a full backup first and attempt to increase desktop heap
http://www.symantec.com/business/support/index?page=content&id=TECH48099
Yes THAT WAS THE SOLUTION FOR THE ISSUE. !!
Now its working perfect!!
Why now its working and not before? Because after made the changes to the registry,
RESTART IS NECESSARY to apply the changes and I have done it yesterday night (this server is working 24x7, so its hard to find a moment to restart it).
Thanks for all to help me with this issue!!! I really,really ,really ,really apreciate !!!
THANKS !!!!! -
Error when using Windows Task Scheduler in C#
I am using Windows Task Scheduler in my Visual C# application. I add the reference to C:\Windows\SysWOW64\taskschd.dll (on a 64-bit system), and Visual Studio creates a COM wrapper Interop.TaskScheduler.dll. Ths works fine on Windows 7. However, when
I run on Windows 8.1, I get the following error:
Unable to cast COM object of type 'System.__ComObject' to interface type 'TaskScheduler.IExecAction'.
This operation failed because the QueryInterface call on the COM component for the interface with IID
'{4C3D624D-FD6B-49A3-B9B7-09CB3CD3F047}' failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
I noticed that on Windows 7, the above GUID exists in the registry under HKEY_CLASSES_ROOT\Interface, with the value "IExecAction". But on Windows 8.1, there is no such GUID, and no key with value "IExecAction". I use IExecAction
in my code.
When I develop on Windows 8.1, the program compiles, but at runtime I get the above error.Hello tomszms,
Here is a blog related to this issue and the troubleshoot steps of his error is very useful for your case, so please check for it:
http://blogs.msdn.com/b/smondal/archive/2012/10/02/unable-to-cast-com-object-of-type-system-comobject-to-interface-type-microsoft-visualstudio-ole-interop-iserviceprovider.aspx
Please try use the same way to track the logs and then try use the regsvr32
on your Win 8 machine to re-register that dll and see the result.
Best regards,
Barry
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Open local windows task scheduler programmatically from a button
What is the code to call windows task scheduler in visual basic 2013? I am not scheduling a task during this process, instead the requirement is to just attach code in a button that opens user's "Windows Task Scheduler" onclick. It would be more
like the programmatic equivalent of typing "taskschd.msc" on the Run dialog box. Users OS are Windows 7 and 8. I appreciate your help.System.Diagnostics.Process.Start("Schtasks.exe"); opened a console screen in the background, ran several lines and
quit. What I need is something similar that will simply open the Task Scheduler as shown on the attached. Thanks. -
Dear all,
I'm an experiencing an issue when configuring 2012 R2 DirectAccess multisite.
The initial configuration of the first site in a multisite setup works fine, however when i try to add ANY other server on another site, i see the below screenshot, the full text of which is: "The remote access configuration task (raconfigtask) in Windows
Task Scheduler cannot be disabled" while the entry point is added.
THere are no logged events on the remote server, but on the controlling server i see this in the event log:
Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>
And this in the taskscheduler:
Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>
Any ideas what might be causing this? All servers are in the same domain, firewalls don't seem to be dropping anything, SCCM client is installed, but thats it.
Appreciate any feedback.
JimDear all,
I'm an experiencing an issue when configuring 2012 R2 DirectAccess multisite.
The initial configuration of the first site in a multisite setup works fine, however when i try to add ANY other server on another site, i see the below screenshot, the full text of which is: "The remote access configuration task (raconfigtask) in Windows
Task Scheduler cannot be disabled" while the entry point is added.
THere are no logged events on the remote server, but on the controlling server i see this in the event log:
Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>
And this in the taskscheduler:
Log Name: Microsoft-Windows-TaskScheduler/Operational
Source: Microsoft-Windows-TaskScheduler
Date: 10/15/2014 12:55:58 AM
Event ID: 140
Task Category: Task registration updated
Level: Information
Keywords:
User: SYSTEM
Computer: WWCLORAS01.apco.net
Description:
User "S-1-5-18" updated Task Scheduler task "\Microsoft\Windows\RemoteAccess\RaConfigTask"
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-TaskScheduler" Guid="{DE7B24EA-73C8-4A09-985D-5BDADCFA9017}" />
<EventID>140</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>140</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2014-10-15T07:55:58.432317300Z" />
<EventRecordID>1738</EventRecordID>
<Correlation ActivityID="{D4236B4E-E841-0003-E5BA-23D441E8CF01}" />
<Execution ProcessID="840" ThreadID="3852" />
<Channel>Microsoft-Windows-TaskScheduler/Operational</Channel>
<Computer>WWCLORAS01.apco.net</Computer>
<Security UserID="S-1-5-18" />
</System>
<EventData Name="TaskUpdated">
<Data Name="TaskName">\Microsoft\Windows\RemoteAccess\RaConfigTask</Data>
<Data Name="UserName">S-1-5-18</Data>
</EventData>
</Event>
Any ideas what might be causing this? All servers are in the same domain, firewalls don't seem to be dropping anything, SCCM client is installed, but thats it.
Appreciate any feedback.
Jim -
Using scripting with networking equipment under Windows
It can be a challenge to use scripting to automate working with Cisco devices. The Cisco IOS does not seem to directly provide a command line interface. You are forced to find a way to automate interaction with a telnet or ssh session.
The PERL language provides a number of object-oriented methods to help manage an interactive session, most notably Net::SSH::Expect and Net::Appliance::Session. These options can work well in a Unix environment, but not under MS Windows.
There are PERL for Windows options, the best probably being Strawberry PERL. There is also a Unix under Windows option known as CYGWIN that is freely available. Unfortunately none of these will work well with the way Windows manages low-level terminal I/O. The curious can google "windows pseudo terminal" to see all the technical details.
One way that does work under Windows is Tcl. It was initially named Tool Command Language. It is sometimes shown as Tcl/Tk.
Interestingly enough, Tcl is included within Cisco IOS as tclsh. There is no interaction with the tclsh and this example. It is just a bit of a curious coincidence.
A Tcl port to Windows can be downloaded from http://www.activestate.com/activetcl/downloads. Select Download ActiveTCL for Windows. A direct link to the download that worked at the time of writing is Download ActiveTcl 8.5.14 for Windows (x86)
Once base Tcl has been downloaded and installed there is one other component that will need to be installed from the Tcl Extension Archive, the expect package.
The teacup program that is installed with the base Tcl package makes this easy. The teacup program will work with a proxy.
You can set these Windows environment variables to specify proxy details:
set http_proxy=
set http_proxy_user=
set http_proxy_pass=
Then run teacup install expect
The plink tool from the PuTTY download is also needed. It can be obtained from http://www.putty.org/.
The sample that follows assumes that the data files, script and plink.exe executable all reside in the same directory.
A sample Tcl script follows that reads a file of devices and a file of commands. It will run the list of commands against each device in the device file. It has some basic error checking, but should best be considered a ‘beta’ version. You could do more complex interactions in the Tcl script by adding exp_send and expect command statements. In short, if you can type it you could script it!
Change directory to where your script, plink.exe and data is stored and run with tclsh <script_name>
devices.list
# Comment lines are allowed if they start with a hash mark
# <IP_Addr> <userid> <password> <ssh|telnet> <timeout_in_secs>
nnn.nnn.nnn.nnn <userid> <password> ssh <timeout_in_secs>
nnn.nnn.nnn.nnn <userid> <password> telnet 30
commands.list
# term length 0 needed or else IOS will wait for an enter to be pressed at the --More-- prompts
term length 0
show run
exit
Script:
# Run batch commands against one or more devices
package require Expect
exp_log_user 0
set exp_internal 0
set exp::nt_debug 0
set prompt "(#\s*$|>\s*$)"
set env(TERM) dumb
set file_channel [open "devices.list" r]
set DEVICES [read $file_channel]
close $file_channel
set file_channel [open "commands.list" r]
set COMMANDS [read $file_channel]
close $file_channel
set command_entries [split $COMMANDS "\n"]
set device_entries [split $DEVICES "\n"]
proc timedout {{msg {none}}} {
send_user "Timed out (reason: $msg)\n"
if {[info exists ::expect_out]} { parray ::expect_out }
exit 1
foreach device_entry $device_entries {
if {[string length $device_entry] == 0 || [regexp {[ \t]*#} $device_entry]} { continue }
set device [lindex $device_entry 0]
set user [lindex $device_entry 1]
set pass [lindex $device_entry 2]
set mode [lindex $device_entry 3]
set wait [lindex $device_entry 4]
set serial [lindex $device_entry 5]
# puts "Device=$device"
# puts "User=$user"
# puts "Mode=$mode"
# puts "Wait=$wait"
set timeout $wait
# Spawning the Session
# If you are logging on to the remote machine using "ssh", "slogin" or "rlogin", the information
# gets processed in a slightly different manner. With any of these methods, it is necessary to
# include an additional -l option to specify a username.
# Next, the $spawn_id variable is captured, storing information about this spawn session in
# memory for future reference.
# If you are logging in via Telnet, the final code block in this section is required to pass the
# username to Telnet. If the login is completed before the script times out, the exp_send command
# passes the username.
switch -exact $mode {
"telnet" { set pid [spawn plink -telnet -l $user $device] }
"ssh" { set pid [spawn plink -ssh -l $user -pw $pass $device] }
"serial" { set pid [spawn plink -serial $serial -l $user -pw $pass $device] }
set id $spawn_id
if {$mode == "telnet"} {
expect -i $id timeout {
timedout "in user login"
} eof {
timedout "spawn failed with eof on login"
} -re "(login|Username):.*" {
exp_send -i $id -- "$user\r"
# Handling Errors
# The error-handling section of the script is a while loop that anticipates a number of problems
# that could occur during login. This section is not exhaustive. For example, you could also add
# provisions for invalid usernames and passwords.
# If the login is not completed during the allotted time frame, which is set from the devices.list file
# and specified with expect -i $id timeout, the program displays an appropriate error message.
# The remainder of this loop makes use of the exp_send command to allow for other scenarios, such
# as the user typing "yes" when prompted to proceed with the connection, entering a password, or
# resetting the terminal mode.
set logged_in 0
while {!$logged_in} {
expect -i $id timeout {
timedout "in while loop"
break
} eof {
timedout "spawn failed with eof"
break
} "Store key in cache? (y/n)" {
exp_send -i $id -- "y\r"
} -re "\[Pp\]assword:.*" {
exp_send -i $id -- "$pass\r"
} "TERM = (*) " {
exp_send -i $id -- "$env(TERM)\r"
} -re $prompt {
set logged_in 1
foreach command $command_entries {
if {[string length $command] == 0 || [regexp {[ \t]*#} $command]} { continue }
# Sending the Request
# If the login is successful, the code in the if statement below is used to send the "cmd" request
# to display files and directories. After the request is sent with exp_send, the resulting output
# is captured in the dir variable, which is set on the fourth line of the code shown below.
if {$logged_in} {
exp_send -i $id -- "$command\r"
expect -i $id timeout {timedout "on prompt"} -re $prompt
puts "$expect_out(buffer)"
# Closing the Spawned Session
# The exp_close command ends the session spawned earlier. Just to be sure that session
# does indeed close, the exp_wait command causes the script to continue running until a result is
# obtained from the system processes. If the system hangs, it is likely because exp_close was not
# able to close the spawned process, and you may need to kill it manually.
catch { exp_close -i $id }
exp_wait -i $id
set logged_in 0
*** End of Document ***Your friend will have to save the templates as CS6, which he can do.
-
Need to run php script before the Flash component kicks in
I have a slide show component in Flash which uses an xml file to load images. The xml file, however, is created dynamically when the user selects which slide show they want to see. How do I run the php script BEFORE the slide show component has a chance to look for it? Usually it begins as soon as the .swf is run.
thanks,
chopthank you for responding.
I'm still new at as3 so forgive me for needing details.
I searched adobe for help and came up with the following to import the component. However, it seemed too easy to be true and so it was. I received errors when I ran it. The component is a commercial one called SlideshowBox and is in my library with that exact name.
//add a component to the stage
import fl.controls.SlideshowBox;
var aSlideshowBox:Button = new Button();
addChild(aSlideshowBox);
errors:
Scene 1, Layer 'Actions', Frame 1, Line 3 1172: Definition fl.controls:SlideshowBox could not be found.
Scene 1, Layer 'Actions', Frame 1, Line 3 1172: Definition fl.controls:SlideshowBox could not be found.
Scene 1, Layer 'Actions', Frame 1, Line 4 1180: Call to a possibly undefined method Button.
thank you, k -
Hello, everybody. I'm wondering if it's possible to run a HTML PHP script in a report region which type is HTML format? Something like:
<?php
echo phpinfo();
?>
As I can imagine, this code could not be handled to PHP compiler although as I know, the ORACLE appication server has been compiled together with PHP 5. So is there any tricks to make this work, or does APEX have some plan to make similar things work in the later version?
Thanks!I have a PHP application that opens up a template (MS
Word) invoice file, inserts some information in the
file (eg. today's date, customer name) and then saves
it as a new Word file. My questions are as follows.
1- How can I call this script from my Java
application. Please note that I want to be able to
pass parameters (eg. custome name read from a DB) from
my Java app. to this script.You would have to call the PHP interpreter through Runtime.exec(), I believe. I haven't done anything with it, but you would have to build the command that would normally be typed on the command line as a string and pass it to Runtime.exec().
2- Is it possible to print already saved MS Word
documents from Java? If so, how?Try looking at the Jakarta POI project.
3- Is it possible to do what my PHP script is doing in
pure Java? I couldn't find a simple way of doing this,
that's why I used PHP but I would like to do this in
Java if I can.Same as 2. -
Trouble using Run Shell Script with python in Automator
Hi. I have a python script I want to run in Automator (update_puzzles.py). All it does is check, rearrange and update files and there is not supposed to be any input. I can get the script to run outside of Automator, in Terminal, by navigating to the right directory and typing "python update_puzzles.py"
I must not be setting up Run Shell Script correctly. I have it set to /bin/bash and Pass Input to stdin. The command line simply reads python /pathname/update_puzzles.py (where pathname is the path to the .py file, which I got by dragging the file onto the Run Shell Script command window). There are no actions before this in my workflow and the action after is View Results.
The log says Run Shell Script failed, and the error is "Traceback (most recent call last):"
Any suggestions?
Thanks so much.If the script is expecting to do stuff with files in the same directory as the executable, you will probably need to add a statement to change to the appropriate working directory. The shell used in the Automator *Run Shell Script* action is a generic one that does not share any of the environment variables that the Terminal uses.
Maybe you are looking for
-
Windows - No Disk Modal Dialog
When porting a project from Flex2 to Moxie under 2.1 build I am receiving a error "Exception Processing Message c0000013 Parameters 75b6bf9c 75b6bf9c". This code is a mix of classes, packages and MXML code which does compile in Flex2. I have a screen
-
ITunes duplicates all of the songs in my library when I try to import it
I haven't used iTunes for years. I've just installed the latest iTunes on my computer and am trying to add songs from a previous library by dragging into iTunes. Problem is, it carries out some sort of conversion on the files and, in the process, d
-
ITunes U Browser Issues with Authentication
We have had iTunes set up for a while and has worked well up until yesterday. If you click on the following link http://www.aacc.edu/sp/itunes/ifpod.cfm it will not work with IE. It only works with FireFox. I keep getting the following error: Error:
-
I need to display pie chart data tips at specified location instead of default location?
I need to display pie chart data tips at specified location instead of default location? can any body let me know how to do that? thanks guys.
-
Running an Update form in Query mode from the MENU
Could any one explain how to run the same Form from the same Menu with two different options, One in QUERY ONLY MODE and one in Update mode. We are using Designer 6i and Headstart 6.5. Thanks David Short