Can’t run get semget to create semaphores in cygwin - cygwin

I am running cygwin on windows 8, when I call semget function i get an error, function not implemented. Does anyone know how to make this work, any point in the right direction would be appreciated. Thank you.

https://cygwin.com/cygwin-api/std-notes.html
The XSI IPC functions semctl, semget, semop, shmat, shmctl, shmdt,
shmget, msgctl, msgget, msgrcv and msgsnd are only available when
cygserver is running.
so run the cygserver. It belongs to the Cygwin package
$ cygcheck -l cygwin | grep server
/etc/defaults/etc/cygserver.conf
/usr/bin/cygserver-config
/usr/sbin/cygserver.exe
/usr/share/doc/Cygwin/cygserver.README
Use cygserver-config to install the service.
After you can verify and start the service with:
$ cygrunsrv -Q cygserver
Service : cygserver
Display name : CYGWIN cygserver
Current State : Stopped
Command : /usr/sbin/cygserver
$ cygrunsrv -S cygserver
$ cygrunsrv -Q cygserver
Service : cygserver
Display name : CYGWIN cygserver
Current State : Running
Controls Accepted : Stop
Command : /usr/sbin/cygserver

Related

strange adb behaviour if script is piped into bash

I stumpled upon a strange behaviour that I can not explain. I tried to narrow down the problem. I have the following test testscript.sh script:
echo before
adb shell ls
echo after
If I run the script with bash -x testscript.sh, everything works as expected and I get the following output:
+ echo before
before
+ adb shell ls
acct
bin
bugreports
...
sdcard
storage
sys
system
ueventd.rc
vendor
+ echo before
before
But if I run the script as piped script with cat testscript.sh | bash -sx, I get the following output:
+ echo before
before
+ adb shell ls
acct
bin
bugreports
...
sdcard
storage
sys
system
ueventd.rc
vendor
The last echo after is not executed, and I can not figure out why. The script is running on an Ubuntu server 18.04. The adb is the one from the official Ubuntu package.
$ adb --version
Android Debug Bridge version 1.0.39
Version 1:8.1.0+r23-5~18.04
Installed as /usr/lib/android-sdk/platform-tools/adb
$ bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Please could someone enlight me, what is happening here.
When you run a script with bash scriptname, standard input of all the commands it runs is still connected to the terminal. So adb will read its standard input from the terminal.
When you redirect the input of bash, this redirection is inherited by adb. Unless you use the -n option to adb shell, it will read additional input from standard input and send it to the remote system as possible input for the command you run (it doesn't know that ls doesn't read standard input).
Change it to
adb shell -n ls

unable to send mail using Mutt

Recently we have migrated Unix OS to new flavor. Since then we couldn't able to send mails. I think we are missing some configuration, Could someone help in resolving the issue.
Command: echo "" | mutt -s "subject" -i /tmp/test.txt -a /tmp/test.txt xxx#gmail.com
Error: Can't stat xxx#gmail.com: No such file or directory
xxx#gmail.com: unable to attach file.
Current OS: Oracle Linux Server release 7.1
Mutt 1.5.21 (2010-09-15)
Please let me know what would be the issue.
Take a look at the man page. It states, that -a takes a list of arguments, which need to be terminated by --.

What's the difference between the commands 'sudo gearmand -d' and 'sudo service gearman-job-server start'?

I'm learning gearman and found that there are two ways to start the gearman:
sudo gearmand -d
sudo service gearman-job-server start
What's the difference?
When to use each of them?
Thanks for any feedback!
Well this is not specific to gearmand but it applies to almost all linux daemons/services.
The program/service can be invoked through different ways. Directly from the terminal, through scripts in /etc and other means. I am assuming you know what sudo does.
# gearmand -d
You are invoking gearmand executable directly. The shell knows where the executable is, because the PATH is set. You may search its location by using "whereis gearmand" or finding it with find.
This is the direct way of calling the application/service.
"daemon" is a background process. The "-d" argument to gearman starts it in daemon mode (in background).
Advantage/s:
If you compile multiple version of the service on the same machine, in this case "gearman", you can invoke them individually without installing/reinstalling.
Sometimes the installation doesn't work or the service might not support startup scripts etc.
Disadvantage/s:
May not give a uniform output like standard scripts / commands.
You may need to know the location of the file.
# service gearman-job-server start
calls the script service which usually looks into the directory "/etc/init.d". If you wish to find where service is searching for the services in your linux distribution, you can look it up.
Search the location of service script "whereis service" then open it in less by "less path_to_service" or directly by "whereis service | cut -d " " -f2 | xargs less" to see the service file.
The service script sort of standardizes the way scripts are called in linux these days.
$ service service_name start
service_name started
$ service service_name start
service_name already running
$ service service_name stop
service_name stopped.
$ service service_name stop
service_name not running.
This provides a uniform way of starting or stopping all services.

BASH - how to make this always running from system boot and on crash restart?

I have this protocol port open to read remotely from Python, PHP applications but daily it crash and the port is unavailable as a result Python, PHP all client application fails
$ cat /var/tmp/server.sh
#!/bin/bash
while true; do tail -f /usr/local/freeswitch/log/freeswitch.log | nc -l -p 9999 -q 1 &
Q. Is there anyway to make this script always running like service this start or stop and if its crashed that somehow it automatically again get restarted ? Any advise or link to do such thing? i am using CentOS 6.x
Put your script in /etc/inittab as following
id:1:respawn:/var/tmp/server.sh
Refer to http://linux.about.com/od/commands/l/blcmdl5_inittab.htm for more information about the /etc/initab file.
After editing /etc/inittab restart your system.

how to start the tomcat server in linux?

i tried to install
1.yum install -zxvf apache-tomcat-6.0.47.tar.gz then
2. export TOMCAT_HOME=/home/mpatil/softwares/apache-tomcat-6.0.37
3. [root#localhost mpatil]# echo $TOMCAT_HOME
/home/mpatil/softwares/apache-tomcat-7.0.47
while starting tomcat by using this command
4.[root#localhost mpatil]# /startup.sh
bash: /startup.sh: No such file or directory
i don't know why it showing like this.
my file in
5.[root#localhost mpatil]# find /home -type f -name apache-tomcat-6.0.37.tar.gz
/home/mpatil/Downloads/apache-tomcat-6.0.37.tar.gz
what i tried before this is is correct or not? --please tell me
my question is how to start a tomcat server in linux.Please tell me..
The command you have typed is /startup.sh, if you have to start a shell script you have to fire the command as shown below:
$ cd /home/mpatil/softwares/apache-tomcat-7.0.47/bin
$ sh startup.sh
or
$ ./startup.sh
Please try that, you also have to go to your tomcat's bin-folder (by using the cd-command) to execute this shell script. In your case this is /home/mpatil/softwares/apache-tomcat-7.0.47/bin.
Use ./catalina.sh start to start Tomcat. Do ./catalina.sh to get the usage.
I am using apache-tomcat-6.0.36.
if you are a sudo user i mean if you got sudo access:
sudo sh startup.sh
otherwise:
sh startup.sh
But things is that you have to be on the bin directory of your server like
cd /home/nanofaroque/servers/apache-tomcat-7.0.47/bin
I know this is old question, but this command helped me!
Go to your Tomcat Directory
Just type this command in your terminal:
./catalina.sh start
cd apache-tomcat-6.0.43 ====: Go to Tomcat Directory
sh bin/startup.sh =====: Start the tomcat on Linux
sh bin/shutdown.sh ======:Shut Down the tomcat on Linux
tail -f logs/catelina.out ====: Check the logs
Go to your Tomcat Directory with : cd/home/user/apache-tomcat6.0
sh bin/startup.sh.>> tail -f logs/catelina.out.>>
Go to the appropriate subdirectory of the EDQP Tomcat installation directory. The default directories are:
On Linux: /opt/server/tomcat/bin
On Windows: c:\server\tomcat\bin
Run the startup command:
On Linux: ./startup.sh
On Windows: % startup.bat
Run the shutdown command:
On Linux: ./shutdown.sh
On Windows: % shutdown.bat
To run Apache Tomcat server in Linux following ways can be used. Let me share the difference as well since I see some got confusions with the multiple ways Apache Tomcat Server can be started.
The catalina.sh is the main control script for Tomcat. Following are the multiple ways of running tomcat:
./catalina.sh run
Passing "run" argument for catalina.sh --> starts the Tomcat in the foreground and displays the running logs in the same console. when the console terminal is closed it will terminate the tomcat.
./catalina.sh start
Passing "start" argument for catalina.sh --> starts the Tomcat in the background. Since in background no issues closing down the terminal. The logs need to be viewed as below: tail -f $CATALINA_HOME/logs/catalina.out
./startup.sh
The last way is firing the startup.sh to start your Tomcat server. If you Vi the script you can see it calls catalina.sh script passing start as the argument. This will be running in background as well.

Resources