Run Perl script in SunOS machine [closed] - perl

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
We have a SunOS machine where we run our daily jobs, on failures we usually login into the machine (using Putty) and run a perl script that take an input parameter to start the failed jobs. Similarly if we need to stop a job we follow the same process and run another script.
I would like to formulate a single script outside of the remote machine which would follow the process of logging in , navigating to the directory where the script is and running the script.
Just looking for ideas as to see how i can implement this

I would recommend looking into Net::OpenSSH (https://metacpan.org/pod/Net::OpenSSH). I've used this with great success to connect to remote machines, execute commands, and capture their output. Also, connection creation can be greatly simplified if you set up passwordless authentication to your remote machines. Then you can test your commands from the command line (and chain commands together):
ssh host 'cd dir1/dir2 && run_script'
The implementation in the controlling script would be to the tune of:
my $ssh = Net::OpenSSH->new($my_host);
my ($out, $err) = $ssh->capture2($my_command);

Related

Raspberry pi NTP working without conf file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
On raspberry, I was looking at the NTP configuration file under /etc/systemd/timesyncd.conf. All lines are commented (by default) but when I run the timedatectl status command, I get:
...
Network time on : yes
NTP synchronized : yes
...
How NTP works without configuration in conf file ? Where are NTP server links ?
Raspberry pi 3 ; Raspbian 9.13 (stretch)
The NTP management of systemd is called systemd-timesyncd. On my Ubuntu system, the corresponding systemd service is /lib/systemd/system/systemd-timesyncd.service. Typically, when you don't have items activated in a configuration file, daemons use default values. Moreover, if you look at the comment in the configuration file, you will see that the commented items are actually default values:
Entries in this file show the compile time defaults.
You can change settings by editing this file.
Defaults can be restored by simply deleting this file.

How to make an offline translator? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
**Problem: **
The result must be a working translator - offline.
We need http API (self-hosted) similar to Google Translate.
I found a few options:
Install Microsoft Translator on Windows, download dictionaries, and somehow through http transfer requests for translation there
Apertium, this option is closer to reality, but it’s not clear how to set everything up ...
Apache Joshua
Promt, it is perfect but it is very expensive
Install Android on PC, and there is already Google Translate, but again there will be a question of sending http requests
**Todo: **
We need to translate whole sentences, not just individual words.
Maybe there is some kind of command line utility. Or maybe there is something for linux.
Which of the above options is better to look for more information?
The five-minute solution is to do this on Debian or Ubuntu:
sudo apt install apertium-apy # http server for apertium
sudo apt install apertium-eng-spa # install some language data
sudo systemctl enable apertium-apy # start http server on next boot
sudo systemctl start apertium-apy # start http server right now too
You now have translation between English and Spanish that responds to http requests and answers in JSON:
curl 'http://localhost:2737/translate?langpair=spa|eng&q=Eres+la+leche'
You can see all the apt-installable Apertium language pairs with
apt-cache search apertium |grep 'pair$'
If you want more pairs in Apertium, you could try the adding the nightly apt repo with unreleased data (or consider Contributing your own language data).
However, you tagged this neural-network – if you want NN's, or more language pairs than Apertium has, you could train a translator with OpenNMT and data from e.g. http://opus.nlpl.eu/ , but that will definitely take more than five minutes :-)

Is it possible to use distinct supervisor (config) for each user (directory) individually? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
Is it possible to use distinct supervisor configuration for each account on the server. So that every user can use supervisor with different specification on his account. I mean instead of using all the same config file on the server they using a local copy of the conf file and run it separately?
Okay I came across with an article by Peter Ojo in medium that in some way answered my question. It is actually about installing supervisor on a shared hosting but I guess it will do it.
What you need to do is use the — install-dir flag to install
supervisor in a custom location to which your user has full access.
You can use the bin directory in your subfolder, i.e.
/home/yoursiteuser/bin, or create it if it doesn’t already exist. Add
this directory to the PYTHONPATH environmental variable by running the
following command;
export PYTHONPATH=$PYTHONPATH:/home/yoursiteuser/bin
Now you can verify that you have your custom bin directory in the
PYTHONPATH environmental variable by typing
echo $PYTHONPATH
ACTUALLY INSTALLING SUPERVISOR
Now you can install Supervisor using the easy_install command like so
> easy_install — install-dir=/home/yoursiteuser/bin supervisor This
should successfully install Supervisor on your server. Yaay!
USING SUPERVISOR
To use supervisor, you first need to create a configuration file with
the sample configuration. You can do this by running the following
command:
echo_supervisord_conf > supervisord.conf This will create the
configuration file named supervisord.conf in the current directory.
Now you can run supervisor like so;
supervisord –c supervisord.conf The -c flag tells supervisor where to
find the configuration file, in this case it’s right there in the same
current directory.

How to run a Batch script on all connected Computers with Admin rights (Windows 7) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have a Simple Script to create a user and add it to administrators localgroup in a local computer:
NET USER admin password /ADD
NET LOCALGROUP administrators admin /ADD
I'd like to create a script that copy & execute my file (or execute the commands above) in every available computer in my LAN network. i have admin right to do it manually. but i would very like to automate the process of adding user + give it admin privileges with shell script.
p.s.
If there is another way to do it with CMD / PowerShell it would be great.
I don't have access to the internet so third party programs are not an option.

Automated Putty Program? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I have multiple Linux vps's and I need to be able to run a program that executes a command on the servers at the same time, or with minor delay. If someone could point my in the right direction that would be great. Thanks.
In bash, you can run a task in the background by appending & after the command. I would write a script to execute the command on the different servers:
#!/bin/bash
for server in server1.domain server2.domain server3.domain
do
ssh username#$server "mycommand params"&
done
This is for manual execution of a task on a number of remote machines. Of course, you will need to be using public key authentication (not password) otherwise it will hang on the password prompt.
If instead you meant that you want a regularly scheduled task to run on each individual machine, use cron as another answer suggested.