Asterisk does not start up after Trixbox reboots - asterisk

I have been struggling with this for a while and cant seem to find the solution. I am running Trixbox v2.8.0.4 Asterisk 1.6
Whenever my box loses power or when you reboot etc asterisk does not start - Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?)
Which means I need to login and do an amportal start/ amportal restart. After this asterisk works 100% again.
Does anyone have any suggestions?

system v5 init.d script run one-by-one.
In case of trixbox that mean if sendmail NOT started, you not get started asterisk.
Sendmail will not start if you have incorrect domain name. If you have no dns, use something like trixbox.local

The problem for one of my customers in this situation was SELinux. Try:
# restorecon -R /etc/asterisk
# restorecon -R /var/lib/asterisk
# restorecon -R /var/run/asterisk.ctl
# restorecon -R /var/spool/asterisk
This fixed the issue for them.

Related

Website available even with no NGINX processes running

I have pulled into my web server so it has the latest code from my repo, i try to restart nginx - this doesnt do anything.
So I try the command
sudo nginx -s stop, and get the response that its failed because there is no such file or directory "run/nginx.pid" failed.
Trying to run the command ps aux | grep nginx gives me the response: unsupported option (BSD syntax) -- it actually comes out as ps aux > grep nginx in the digital ocean console.
Basically it seems that even though there are apparently no nginx processes running (although the command to check isnt working) my website is still running and using the old code, is there a way for me to check more definitively on the running processes?
Thanks if you can help.
Try sudo netstat -plunt to check if there's any nginx process running. See if there's anything running on port 80 or 443 and then look at the corresponding program name. You might have another server running possibly apache since it ships by default with most distributions which may be why nginx failed to start.
Another reason why it won't start might be due to faulty config. Go to /etc/nginx/ and double check that it's correct. You can also run sudo nginx -t to ensure that the config syntax is correct.
Alternatively, just check your nginx access log to see if it's actually serving any requests. You can also check the error log to see why it might fail to start. These resides in /var/log/nginx by default or check your nginx.conf for any custom path to logs.

systemd network service does not work?

Today, I install ubuntu 16.04 in my machine.
When I boot the system, I can not get the IP address from DHCP server.
The network interface is renamed to enp2s0 from eth0.
I only get the IP address after run command:
$ sudo ethtool -s enp2s0 autoneg off speed 100
I try to add this command in init script (/etc/rc.local) but it does not work after I reboot system.
So, from now, when my machine is booted, I always need to add the above command mannually to get IP address.
Could anyone help me to solve this problem?
Thanks in advance.
Best Regards,
Since you're using ubuntu, use command line and execute the following:
$ sudo crontab -e
and add your script that you want to execute upon restarts by adding this at the end:
#reboot ethtool -s enp2s0 autoneg off speed 100
Hope this helps.
systemd considers both "rc.local" and "crontabs" to be "legacy". It has replacements for both. However, Ubuntu 16.04 supports both concepts.
I think your issue is that now rc.local is run before the network is fully online, causing your command to fail.
Look at /lib/systemd/system/rc.local.service to see how systemd is running your rc.local file. In particular note that the line After=network.target.
Try creating this file:
/etc/systemd/systemd/rc.local.service.d/10-wait-for-network.conf
Add these lines to it:
[Unit]
After=network-online.target
Then reboot and see if that works for you.
References:
Force services to wait for the network to be configured
Using systemd Drop-In units
Also, in the future SO is not the best place for systemd questions. Consider http://askubuntu.com for Ubuntu question instead.
I'll also add that the behavior change you found might be considered a bug in how Ubuntu emulates rc.local support with systemd. If the proposed fix works, perhaps Ubuntu shoudl change the rc.local replacement to load after network-online instead of network.

Dokku view logs? (hosted on digitalocean)

So I just started using dokku (with postegres). My app works on Heroku so I'm pretty sure it's a deployment issue. The app seems to be running but is however hitting issues at log in. I did dokku logs my_app_name however the logs seems to be old. On heroku whenever there is an issue there is an corresponding log, but here I cannot find.
Any ideas are appreciated! Thanks!
To get a continuous log you can type:
dokku logs yourappname -t
It acts as the tail -f command on linux and mac systems.
Dokku logs - docs
I think you can try to use docker logs -f `cat /home/dokku/<app-name>/CONTAINER for getting access to the logs.
In case if you want to see the logs of the specific container:
docker ps
then find your container with postgresql for example and run docker logs -f <CONTAINER_ID>
I hope it could help you to find out the problem.
Out of the topic I found dokku-alt and using it in my current DO image. If you are working with Ruby it's working out of the box comparing with original dokku project.
The easiest:
dokku logs -t *app_name*
up to 300000 lines:
dokku logs -t -n 300000 *app_name* > logs.txt
complete log of container: (needs to be executed on server)
docker container list # to get the container id
docker logs *container_id* > logs.txt
It may not be the answer you are looking for but I was seeing the same issue. I just waited about 30 seconds and the logs were updated. I don't know why they are updated live, but they eventually came through.

How to reload a spawned script for nginx fast cgi

Below is by code for spawing a fcgi script for nginx.
spawn-fcgi -d /home/ubuntu/workspace -f /home/ubuntu/workspace/index.py -a 127.0.0.1 -p 9001
Now, lets I want to make changes to the index.py script and reload with out bring down the system. How do reload the spawned program so the next connections are using the updated program while the others finish? For now I am killing the spawned process and running command again. I am hoping for something more graceful.
I tried this by the way.
sudo kill -1 `sudo lsof -t -i:9001
I have recently made something similar for node.js.
The idea is to have index.py as a very simple bootstrap script (which doesn‘t actually change much over time). It should catch SIGHUP, and reload/reread the application files (which are expected to change frequently).

Why doesn't wireshark detect my interface?

I just installed Wireshark, but when I click capture > interfaces, the dialog box appears, but it does not contain my network interface.
When click on capture > interfaces it appears as in the screenshot below. What can cause this?
This is usually caused by incorrectly setting up permissions related to running Wireshark correctly. While you can avoid this issue by running Wireshark with elevated privileges (e.g. with sudo), it should generally be avoided (see here, specifically here). This sometimes results from an incomplete or partially successful installation of Wireshark. Since you are running Ubuntu, this can be resolved by following the instructions given in this answer on the Wireshark Q&A site. In summary, after installing Wireshark, execute the following commands:
sudo dpkg-reconfigure wireshark-common
sudo usermod -a -G wireshark $USER
Then log out and log back in (or reboot), and Wireshark should work correctly without needing additional privileges. Finally, if the problem is still not resolved, it may be that dumpcap was not correctly configured, or there is something else preventing it from operating correctly. In this case, you can set the setuid bit for dumpcap so that it always runs as root.
sudo chmod 4711 `which dumpcap`
One some distros you might get the following error when you execute the command above:
chmod: missing operand after ‘4711’
Try 'chmod --help' for more information.
In this case try running
sudo chmod 4711 `sudo which dumpcap`
In Windows, with Wireshark 2.0.4, running as Administrator did not solve this for me. What did was restarting the NetGroup Packet Filter Driver (npf) service:
Open a Command Prompt with administrative privileges.
Execute the command sc query npf and verify if the service is running.
Execute the command sc stop npf followed by the command sc start npf.
Open WireShark and press F5.
Source: http://dynamic-datacenter.be/?p=1279
For *nix OSes, run wireshark with sudo privileges. You need to be superuser in order to be able to view interfaces. Just like running tcpdump -D vs sudo tcpdump -D, the first one won't show any of the interfaces, won't compalain/prompt for sudo privileges either.
So, from terminal, run:
$ sudo wireshark
As described in other answer, it's usually caused by incorrectly setting up permissions related to running Wireshark correctly.
Windows machines:
Run Wireshark as administrator.
By Restarting NPF, I can see the interfaces with wireshark 1.6.5
Open a Command Prompt with administrative privileges.
Execute the command "sc stop npf".
Then start npf by command "sc start npf".
Open WireShark.
That's it.
On Fedora 29 with Wireshark 3.0.0 only adding a user to the wireshark group is required:
sudo usermod -a -G wireshark $USER
Then log out and log back in (or reboot), and Wireshark should work correctly.
I hit the same problem on my laptop(win 10) with Wireshark(version 3.2.0), and I tried all the above solutions but unfortunately don't help.
So,
I uninstall the Wireshark bluntly and reinstall it.
After that, this problem solved.
Putting the solution here, and wish it may help someone......
Just uninstall NPCAP and install wpcap. This will fix the issue.

Resources