Can't install CYGWIN as windows service - service

I've installed CYGWIN on my windows server,
And now I'm trying to run it as a service so it will be running on every system startup, This is the command I tried but I get the error:
C:\cygwin64\bin>C:\cygwin64\bin\cygrunsrv.exe -I CYGWIN_SSHD -path C:\cygwin64\b
in\cygstart.exe
/usr/bin/cygrunsrv: Trailing commandline arguments not allowed
Try `/usr/bin/cygrunsrv --help' for more information.
Can anyone tell me what am I doing wrong?

I figured it out, To install Cygwin as a service I needed to run "ssh-host-config" insert all the needed definitions and this will install it as a service called "CYGWIN sshd".

Related

.sh script that executes command as "real" root

I want to write a .sh-script that sends a message to my ejabberd-account. (the script is "called" by the apache2 standard-user "www-data").
The script should execute the following command: ejabberdctl send_message chat admin#my-domain user#my-domain "title" "my message"
However, I can't run any ejabberdctl command without "being" root. So sudo ejabberdctl is not working (in terminal or any .sh-script). I can only do sudo -s followed by ejabberdctl my-command, which doesn't work in .sh-scripts (or am I wrong?).
(I've installed ejabberd 20.07 on ubuntu 20.04 with the help of this tutorial: Install Ejabberd...)
Is there a way to run a command in a .sh-script as "real root" or to create a root-session and run the command there (like I do manually with sudo -s ...)?
Is there any solution to my problem or should I install ejabberd the "normal way"?
When ejabberd is compiled and installed from source code, it's possible to prepare it with something like
./configure -–enable-group=ejagroup
Then, you can simply create the system group ejagroup, and add the www-data user to that ejagroup.
See https://docs.ejabberd.im/admin/installation/#options
In your case, that you use the Debian package from ProcessOne, I see the tutorial mentions that you create a system account called ejabberd. Maybe you can run ejabberdctl from that account, no need to be root?
I still don't know why I can only run ejabberdctl when I'm "logged-in" as root (sudo ejabberdctl is still not working)
Is my .bashrc file wrong? (last line: PATH=$PATH:/opt/ejabberd-20.07/bin/)
Anyway, at least I can run sudo /opt/ejabberd-20.07/bin/ejabberdctl my_command with any user, like they did here: Ejabberd sbin/ejabberdctl start (No such file or directory)
Has someone else experienced this weird behavior with sudo: any_command: not found ?
Let me know if you have a more "elegant" solution to my problem.

Windows subsystem for Linux : Command Not Found Error

I have installed windows subsystem for Linux to run Ubuntu 16.04 on my windows 10 home platform.
I have extracted all required directories to run KSQL on this platform.
Now, when I am trying to run any command after navigating to the bin folder. It's throwing command not found error. I tried to add PATH as well but it's not working.
Please suggest.
There's a typo in your command:
export PATH=$PATH:/opt/kafka/confleuent-5.4.0/bin
Instead of confluent-5.4.0 you misspelled it confleuent-5.4.0.
The easiest way to install Confluent CLI, is by making use of the scripted installation:
Install the Confluent CLI using this script. This command creates a
bin directory in your designated location (<path-to-directory>/bin).
The location must be in your PATH (e.g. /usr/local/bin). On Microsoft
Windows, an appropriate Linux environment may need to be installed in
order to have the curl and sh commands available, such as the Windows
Subsystem for Linux
curl -L https://cnfl.io/cli | sh -s -- -b /<path-to-directory>/bin
Finally, if you run confluent start you can get all services up and running, including KSQL (assuming that you have correct configuration files).
You could just use the path
cd bin
./kafka-topics.sh
Also, all those commands work in CMD / PowerShell as well
If you want to run KSQL, I'd suggest just using Docker

Cannot run TopShelf install remotely using psexec

I am trying to install a windows service on a remote machine. The service is implemented using TopShelf. I am running the following psexec command:
psexec \\remoteServerName "C:\PathToExe\TopShelfServiceName.exe" "install"
The error I am receiving is:
ERROR - The service terminated abnormally
Topshelf.HostConfigurationException: The service was not properly configured:
[Failure] Command Line An unknown command-line option was found: ARGUMENT: "install"
It appears that I am not running the TopShelf installer, rather executing my exe and passing "install" which is not a valid argument.
Any help is appreciated!
I don't think you need quotes around "install":
psexec \\remoteServerName "C:\PathToExe\TopShelfServiceName.exe" install

ActivePerl and PPM

I have installed ActivePerl 5.14.2 on a Windows 32 bit machine running XP. My problem is that I'm trying to install a few modules with PPM and it's not working out.
According to ActiveState's website, all you need to do to install a module from their repository is "ppm install module name" , example: http://code.activestate.com/ppm/Template-Toolkit/
Every time I try this or any other module I get: "No Perl script found in input"
Even when I do just "ppm" I get the same message, even though the GUI should run.
When I run PPM with a GUI from the start menu I get this error: "Failed 500 Can't connect to ppm4.activestate.com:8080 (connect: timeout)”
I though that it might be my connection, so using cmd.exe I used the set HTTP_PROXY command and then tried ppm install, but still no luck. So is there any way I can get these modules installed?
Any advice is appreciated !!
Invoke the cpan prompt from your command prompt. Go to cmd and simply type cpan. If you successfully enter cpan prompt them there is probably no issues with your Perl installation. To install a module from cpan prompt just use
cpan>install Module::Name
Screenshot below shows command to install module Net::Stomp
If the above does not work, check if your FTP data and connection ports needs to be added to the Windows firewall exceptions (Ports 20 (FTP Command port) and 21 (FTP Data port)).
Alternatively (if you don't want to add port 20 21 to exception), you can go to the cpan prompt and use an ftp_proxy by
cpan> o conf ftp_proxy http://your.ftpproxy.com
and then issue install command. Or you can update your ../CPAN/config.pm file to make permanent changes to the ftp_proxy parameter.
The next step would be to try set the FTP_PASSIVE mode to 1. By default the libnetcfg configuration for this is set to 0. To change this find libnetcfg.bat file (should be somewhere C:\Perl\bin), open the file in an editor and replace
ftp_int_passive 0
to
ftp_int_passive 1
Again, looking at you r timeout error it seems that your network is blocking you from accessing the CPAN ftp mirrors, this would happen mostly if you are inside a corporate VPN. The solution to this can only be proxy servers.

swlist command to get software installed on different system

When you run swlist with no arguments on an HPUX system you get the packages that are installed on that particular host. I want that same output but instead listing packages that are installed on a different system.
Is this possible?
find $(perl -e 'print"#INC"') -name \*.pm
will get you most of the way there.
Try using Net::SSH::Expect to execute the swlist command on the remote host, grab the output and do what you want with it. That's what I would do.