Can I start a service on remote machine using NSIS script. I know we can use:
sc \\machine start servicename
through DOS prompt. But can we do the same in NSIS? Can SimpleSC be used for this?
You could use exec.
ExecWait 'net start $servicename'
Edit: Oh, you meant starting the service on the remote machine...well:
ExecWait 'sc \\machine start servicename'
Related
I have a ngrok account - and I would like to run the program in the terminal automatically when the computer boots up.
How can I create a file that will be executed right away and calls the process, e.g. this one
" ./ngrok start configfile"
Thank you!
Frank
Most Linux distributions includes scripts in /etc/init.d directory, which are started during the boot process (or executed when you shutdown or reboot the system). For instance on Redhat or CentOS Linux, the /etc/init.d/httpd script runs at boot time, and starts Apache daemons.
/etc/init.d - Linux Shell Scripting Tutorial - A Beginner's handbook
Is it possible to replace the erl shell with a system command? Similar to how you would with a POSIX exec call?
I'm trying to set up an SSH server in Erlang that gives a separate CLI instead of the built in one. I'm aware of OpenSSH's sshd's options to do this; does Erlang have something similar?
For example, how would I get the following command to work as it does with sshd(8) in an Erlang environment?
# connect to Erlang SSH server and drop into IPython shell
ssh user#host ipython
I have the server working fine—I'm able to connect without problems—and I know that you can develop your own CLI with the ssh_cli option for ssh:daemon. It might have something to do with ports and drivers or the user_drv:start command, but I'm having difficulty figuring out how this all works.
Jenkins is running on windows machine and I am trying to copy files from windows to unix as a build step.
SSH sever details has been configured in the global configuration and connected successfully.
kindly share the Exec command to copy files from windows to unix
You need some kind of ssh client on your windows. I suggest Winscp, which is simple, easy and fast.
Winscp is a GUI application but as you want to run something from Jenkins you need to have a command line tool. Good news is that you can run Winscp in command line. Then the following steps should answer your question:
Install Winscp on the Windows machine.
Add your Winscp installation path (sth like C:\Program Files (x86)\WinSCP) to your system environment path variable
Now you should be able to run winscp command in windows command prompt
The command below will copy the file, you should read winscp manual for more details:
winscp root:password#UNIX_MACHINE_IP /command "put c:/PATH_TO_FILE_ON_WINDOWS /home/PATH_TO_TARGET_ON_UNIX"
There is a Jenkins plugin that might fit your needs:
https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin
It uses Java SSH library so no need to install another SSH client.
To copy files using PuTTY or any unix shell powered with SSH from windows, run this command.
scp /path/to/file.ext user#m192.168.0.100:/Destiny/path
To run commands in your remote computer just connect to it with:
ssh user#192.168.0.100
Customize the user, the IP and authenticate with the properly password.
I downloaded the native windows Jenkins package and installed it. On installation, it starts as a service in and shows in Task Manager, and also on going to the url localhost:8080. But then it stops. Here is what I get in my jenkins.out.log:
Running from: C:\Program Files (x86)\Jenkins\jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Jenkins home directory: C:\Program Files (x86)\Jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Any ideas what could be causing this? I've checked throuh netstat that no other process is using the port 8080.
I found that the java.exe process was hung and keeping Jenkins from starting. I killed the java process and then jenkins service started up just fine.
Use process explorer.
It's possible to start jenkins via the command line using java -jar jenkins.war, however, because the process is started via the command line it will also end when that command window is closed.
A better way would be to start the service via jenkins.exe but you would have to remind doing that at every startup.
Ultimately we have settled with a batch script with the following content:
cd "C:\Program Files (x86)\Jenkins"
start javaw -jar jenkins.war >> outputFile.txt
adding start before calling javaw makes sure that the command window is not attached to the process started, making it possible to safely close down the command line.
Using >> outputFile.txt writes the command window feedback in a text file, making debugging a whole lot easier when Jenkins ever breaks down!
Save it in a batch script, schedule it with windows Task Scheduler to run at startup et voilà: properly set up Jenkins service.
Only make sure it doesn't stop at log-off.
I switched back to version 1.535 and now it works.
After my win vm system rebooted, the jenkins 1.625.2 service would just keep stopping.
It solved it by:
Kill java processes. Found some old java running dll's.
Uninstall old version of jdk1.6 that was there.
Cleaning java temp. files dir.
Then I was able to restart the service w/o problem.
if java.exe not visible in process
1.netstat -a -o -n find out the PID of your port
2.tasklist /FI “PID eq PID″
3.taskkill /F /PID 2600 kill the process
Frequenlty my work involves to VNC to a remote system and work on it. SInce i run command line apps on this remote system most of the time, i was wondering if there's an alternative software to command prompt which i could install on my local machine. Using this i should be able to create a session with the remote system and from then on all commands issued in command prompt should run in remote system.
localHost>dir --> should list the directory contents in remotehost active directory
localhost>app.exe should run app.exe in remote host and display its contents in localhost command prompt
I browsed a little and read about cmdlets in powershell. But it looks like i need to write a cmdlet for each app in the path (dir, mkdir, app.exe in the path). Correct me if am wrong. Once session is established, i simply need the commands invoked in local host to be run in the remote host and return the console output to local host. Please let me know if powershell + cmdlets are the only way
THanks
Just use PowerShell Remoting if it can be set up (requires a little preparation).
I'm not quite sure why you think of writing own cmdlets for stuff that's already there. dir is an alias to Get-ChildItem which does return the items in the current path (and—depending on options—some other stuff as well). And since PowerShell is a shell it has no problems running external programs too.
SSH is what you're looking for. Cygwin has a SSH server and client.
Unix people do this all the time with SSH. You can install the sshd server on your remote machine through Cygwin, then use PuTTY to connect to it.
As a bonus, PuTTY does not use the clunky Windows cmd.exe program; it's got a much nicer terminal of its own.
You could maybe even run PowerShell on the remote end, so you don't have to learn bash.
Depending upon on how you actuall access the machines PSExec may be an alternative that wont require you to install anything on the remote system.