'ntpdate <server URL>' doesn't change the result of '$date' - ntp

I'm trying to change my ubuntu time to French time using NTP in Ubuntu.
I typed ntpdate <French NTP server> as root like below.
then I checked if it works through ntpd -p
It seemed to work well, but when I typed date to check my local time
The time was still Korean one.(The real local time here is KST, that's right)
I also tried to change /etc/ntp.conf manually, but it didn't work as well!
This is my /etc/ntp.conf file.
I edited this file like this, started ntpd, and could see NTP server was changed through ntpq -p like second snapshots, but my ubuntu time stuck with the Korean time.
How could I see the result of date changed to French using NTP library ???

NTP only changes time, it does not change your current timezone (since it does not have enough information to do that).
To change the timezone run
sudo dpkg-reconfigure tzdata
then choose Europe -> Paris there then restart a machine.

I finally could change my current timezone with NTP by executing
rdate -s <ntp server address>
Thanks.

Related

VS Code - how to run on remote server

In my current work setup I write the code on my own computer and run it on AWS machine. After every change I do, I run rsync to copy my changes to the machine and run the code there.
I work on VS Code and I need the machine to be stateless - more on that later. I try to automate the manual rsync work. I see VS Code has a built in utility - https://code.visualstudio.com/docs/remote/ssh-tutorial but it looks like it assumes the code is on the remote machine. Which is not my case.
I see that the plugin "save and run" can call rsync for me on every save. Which is better than my current setup but I wonder if there is any other solution.
More technical details - at the start on every day I start a machine from a pool of machines. I would probably not get the same machine on the other day, thats why the machines are stateless from my perspective. Yet, during the day, I can assume there is a state and I only need to sync the changes.

pnp4nagios not logging performance data for new host

We've just updated Nagios from 3.5.x to the current version (4.0.7) and subsequently added a new host for monitoring.
The new host shows as 'Down' in Nagios, and this seems to be related to the fact that pnp4nagios is not logging performance data (the individual checks for users, http etc are all find).
Initially there was an error that the directory
/usr/local/pnp4nagios/var/perfdata/newhost.com
that contains the xml setup and rrd files for the new host was missing), so I manually created this directory, but now it complains that the files are missing.
Does anyone know the appropriate steps to overcome this issue?
Thanks,
Toby
PS I'd tag this 'pnp4nagios', but that tag doesn't exist and I can't create them
UPDATE
It's possible that pnp4nagios is a red herring/symptom. Looking more closely I realise that Nagios actually believes the host is down, even though all services are up. The host status information is '(Host check timed out after 30.01 seconds)'...does this make any more sense?
It's indeed very unlikely that pnp4nagios has something to do with your host being down. pnp actually exports output and performance data to feed the rrd database and xml files (via npcd module or evenhandler command).
The fact that nagios reports the host check timed out after 30 sec means that :
- you have a problem with your host check command, please double-check the syntax
- this check command times out after a certain timelapse (most likely defined in nagios.conf) because the plugin was still running.
I'd recommend running this command from the server's prompt. You want to do something like :
/path/to/libexec/check_command -H ipaddress -args
For example:
/usr/local/libexec/nagios/check_ping -H 192.168.1.1 -w 200,40% -c 500,80% -timeout 120
See if something might be hanging. Having the output would be helpful.
Once your host check returns correct output and performance data to nagios, pnp will hopefuly do the rest.
In the unlikely event it helps anyone, pnp4nagios was indeed a red herring. The problem was that ping wasn't enabled for the host being checked, and this is the test for whether a host is up or not. Hence this was failing, despite other services being reported as working.

Listener failed to start

I have a virtual Machine on VMWare Player: Oracle 11g on Linux Centos.
Since I haven't used it for 2 years, I don't remember almost anything,and when I try to startup the db it says listener is down, and when I try to start listener it says:
TNSLSNR for Linux Version 11.2. 0.1.0 - Production
System Parameter file is /oracle/product/11gR2/network/admin/listener.ora
Log messages written to /oracle/diag/tnslsnr/srvlinux/listener/alert/log.xml
Error listening on: (ADRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adater error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
What do I have to configure exactly? Thanks in advance.
EDIT:
netstat -tulpn | grep :1521
tcp 0 0 :::1521 :::* LIST
EN 3369/tnslsnr
EDIT:
lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 11-DEC-2012 16:09:54
sqlplus / as sysdba
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
ORA-12162 usually means you don't have ORACLE_SID set - not that it's wrong, but it hasn't been set at all, or has not been exported (depending on your shell). That doesn't tell you anything about whether the database is up, and doesn't imply the listener is down - so don't know if you got a different message from a different connection attempt. Clearly the listener is up on port 1521, from the details you added to the question.
If you're using something Bourne-y (sh, ksh, bash etc.) you need to set and export your ORACLE_SID:
export ORACLE_SID=my_sid
If you can't remember the SID you can go grep -ef | grep ora_pmon_; if that shows anything then the SID is the end of the process name, and the database is up. If it doesn't then look at the output of lsnrctl status and see if anything is registered, or look in $ORACLE_HOME/dbs - files in there might include the SID in their names too.
You might also need to export ORACLE_HOME if you haven't already, but it sounds like you have, probably from your .profile/.bashrc etc.

Clean couchdb and restart

What is command to clean CouchDB please ? And if I want to disable and re-start my CouchDB what is command?
Thanks
CouchDB can be started/stopped/restarted from the /etc/init.d/couchdb or /etc/rc.d/couchdb startup script.
(This startup script file might be located somewhere else on your system.)
You would do something like this:
To stop: /etc/init.d/couchdb stop
To restart: /etc/init.d/couchdb restart
As far as cleaning goes, I think you mean compaction. This is easiest to do via Futon, which is located here by default: http://localhost:5984/_utils
Login to Futon as an admin, navigate to your database, and there will be links to compact the database.
This can be somewhat dependent on OS and its version. On Ubuntu 14.04, for example (which is transitioning away from sysvinit), /etc/init.d/couchdb commands don't work for me. I have to do:
sudo service couchdb restart
So use the curl method posted by user2744667 (with root/admin privileges), or use the standard method for restarting daemons/services for your OS.
Finally, as a last resort, you could kill the process. This is not the recommended way to do it, and it is not "clean" as you indicated in the question. You will likely find that CouchDB is agressive about respawning itself. But if you are in a homicidal mood, all that kill-ing could be just the thing.
You can restart CouchDb as per the documentation here
Example with curl:
curl -X POST http://localhost:5984/_restart -H"Content-Type: application/json"
On Windows, you don't need to run a GUI like services.msc ... Typing this is usually faster:
c:\> net stop "Apache CouchDb"
c:\> net start "Apache CouchDb"
on Windows, if you installed it as a service, open services.msc, find the Apache couchDB service, and restart.
As I write this, the most recent existing answers are seven years old. Here's some fresher ways of doing this.
On Windows, CouchDB uses nssm.exe for managing the service. A copy of that executable is at <couch-installation-dir>\bin\nssm.exe. If you installed Couch to C:\CouchDB then restarting it is:
C:\CouchDB\bin\nssm restart "Apache CouchDB"
It doesn't have to be that nssm.exe, of course.
Still on Windows, using PowerShell you can restart the service the normal PowerShell way:
ps1 $ restart-service "Apache CouchDB"
Couch being Couch, there's also a plain old HTTP way to trigger a restart. If you have an admin user called admin with password xx then you can do this:
curl http://admin:xx#127.0.0.1:5984/_node/couchdb#localhost/_restart -X POST
The node may not be called couchdb#localhost. To find out, use:
$ curl http://admin:admin#127.0.0.1:5984/_membership/
{"all_nodes":["couchdb#localhost"],"cluster_nodes":["couchdb#localhost"]}

Licensing and auto-delete of a program

I have an application which get copied and run on client machines. The program is in the form of an Adobe Projector file. I want to write a process that checks when the program starts running whether or not the license is still active, and if not, delete the entire program.
The program itself knows the real date that it was installed, and since we install the program ourselves for the clients, we can ensure that at install time the date on the client's computer matches. Every time they start up the program, it compares the current date with the date they last ran the program. If today's date is after that date, it subtracts the number of elapsed dates from the number of days remaining. If the date is before the date it was last run, it penalizes the client by a constant number of days (this is to discourage the client from trying to reset the date on the computer and have their license never expire).
If they were to copy the entire directory over to a new machine, the installation date inside the program would not match the created date on any of the files in the directory, and it would treat this case like an expired license.
My question is this: is there a simple way to script this to run every time they start the application? We currently create a shortcut which could be pointed to a batch job, but what do you put in the batch job? Or is this approach for licensing completely wrong? People who buy this program will only buy time-limited licenses, and the program is run by copying and pasting a directory onto the target machine.
I believe you are thinking too complicated. Why not make it like a trial version that expires n days after installation, first use, or whatever you wish.
About the deleting the exe approach: Be careful, this could be an illegal intervention in somebody elses computer.
Not running software on a system when the trial period has expired is accepted today. I don't think actually deleting the program would be. I know I would never use such an application again.

Resources