Send a message to a machine that is powered off - batch-file

I would like to send a message, or something can be an advise from a pc to an another pc (only one, or at the most 2), the latter is powered off.
The pc which should send the message is a windows server 2003 os, instead the pc which should receive the message is a windows xp os.
The two machines are in the same domain and they work together through an ingres database.
The message will be sent at night, because there is an ingres database back up procedure that runs at night when my pc will be powered off, but when in the morning i will be at work I would like to read this message as a net send message, or something like
Unfortunately the net send command is disabled in our network, so I can't use it, but i'm looking a way for sending this message.
Have you any suggestion? thank you

Use age-old simple file based messaging.
Store a message in a specific file in the server and write a simple application which runs on startup on your machine to read it and display it.
And this is apart from rerun's great suggestion :)

There is breaking new technology available called email.

Is the machine powered off or in standby?
If if is in standby, then I will defer to someone who may have a better idea of how to get wake the machine to wake up programatically(sp?).
If it is powered off then read on...
If you have access to the machines bios settings, then I would suggest scheduling a power on event in the range of the time before the backup normally completes.
Then it is a matter of receiving the message and optionally shutting back down afterward?
If you are unable to change the bios settings, then does the machine "power on after power loss?" If so, get a programmable timer from the nearest retail store and power off before leaving at night and have the timer set to power on before the time the backup could reasonably be completed.
This is not really a software solution per se, but your problem does seem to be mostly hardware related (with the power off requirement and all...)

Related

Read SMBIOS of a remote PC

I know that when a PC is OFF, some components still working ,like the motherboard, the NIC (network card), and others. I thought that like the 'magic packet' send to the NIC on the Wake-on-Lan do, there is a form of sending another signal to this one.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
If someone knows of some code example, or manual which can read to learn, it would be very helpful.
How can I get the SMBIOS table, through the Network Card of a remote and power-off PC?
You can't. WoL is a function of the NIC. When it receives a magic packet it triggers a PMI event, waking up the mainboard - that's it. You can't magically talk through the NIC to the powered down system.
There are two solutions, depending on your actual goal:
Many servers, some workstations and PCs feature lights-out management through a baseboard management controller - features differ, you'll need to select the appropriate product.
Wake the machine, run whatever queries you need and shut it down again. This is a standard procedure for client management.

ipmi-console: SOL connection idle on dell servers

I'm working with server automation tools on some Dell C2100 and C1100 servers. What I intend to do is connecting via Serial Over Lan using ipmi.
A few weeks ago, I was able to connect to one of my servers using ipmi-console (from freeipmi), like this:
ipmi-console -h IPADDRESS -u USER -P
This started up a SOL connection, and this way I was able to automate some interactions with the server's BIOS settings and other stuff.
However, a few days later, the same script didn't work anymore. It just says "[SOL established]", and that's it: the SOL connection never shows any feedback, and it stays idle until I close the connection.
My question is: what could possibly have changed that the SOL connection is not working anymore.
I obviously checked for anything related to SOL and IPMI, both in BIOS settings and using BMC web GUI. But everything looks normal, and I didn't recall to have changed anything there between the time the connections worked and then they stopped working. IDK what else to check, and it just fails w/o errors anywhere.
Perhaps this is a common thing with IPMI and/or SOL, but I frankly don't understand it. So, any pointer would be nice.
Thanks in advance.
FreeIPMI maintainer here. When no data is being output, it is typically a configuration problem. Assuming none of that changed, one idea.
On some motherboards, I've seen the BMC internally "lose its connection" to the serial chip, thus it doesn't get any serial data and thus doesn't have anything to send out. Unfortunately a hard power reset is often needed to solve this (b/c the BMC always is "on" via standby power, it must be a hard reset to reset it). Hard resetting the BMC directly might work as well, you can do this in FreeIPMI via bmc-device --cold-reset.
Finally, I've found what was going on.
It happened that somehow a value DID change on the BIOS settings, most likely my own mistake: remote connection ability was disabled. That means, it seems, that SOL works, but it doesn't redirect anything. Given that I was able to connect through SOL, it seemed obvious that remote connection ability was enabled.
Once enabled that BIOS setting, everything was back to normal.
BTW: freeipmi is awesome. Thanks for maintaining it Albert.

A batch file to check internet connection and shutdown pc, if offline

The title pretty much says it all. So, I have a no-break connected to my PC, because we have a lot of blackouts here where I live. The problem is: if I'm not at home, who will shutdown my PC correctly if there is a blackout? So, I realized that my modem is not connected to the no-break; this means that, in the case of a black-out, my modem will turn off, thus, no internet will reach my computer, so this is kind of a way to tell my PC when lights are out.
Sure, this might not be always the case (sometimes the internet just goes off for reasons other than power), but I will accept this risk.
So, what I am looking for is a code that, once I execute it (what I'll do when I'm leaving home), checks if there is internet conection. If yes, than do nothing and keep checking. If not, than shutdown the computer.

Get system date/time via USB

Is there any way to query the system's date/time via USB without installing anything on the host computer (maybe just drivers)?
Background of the original problem
To avoid the XY problem, let me explain a bit what I'm trying to do.
To be able to calculate a TOTP token for 2FA (e.g. like Google Authenticator app does) you need a real-time clock to get the date and time.
There's this USB device called SC4-HSM that I would like to use to calculate the tokens, however it doesn't have a clock and according to the designer, adding one would be too expensive (needs a battery, etc).
Possible solution to the original problem
This device is going to be used with a computer which already has an RTC of course. Thus I had the idea of querying the system for a date/time which would solve the issue.
(Note: I know that a USB device can be connected to all sorts of hosts and not all hosts will have an RTC, but since this only needs to work with a computer, I thought this shouldn't be an issue)
My first thought was that there might be some USB device class that had date/time needs, so I could register the device as that type and then I would be able to query the values.
After going through the device class codes list (Internet Archive) nothing jumped at me as needing date/time. The closest ones I could think of were:
Content Security (PDF)
Personal Healthcare
Smart Card Class (PDF)
I skimmed the device class documents in the USB Implementers Forum but there's nothing in there even remotely related to date or time.
Current problem
Since the USB specs seemed like a dead-end I thought that maybe there was a way to write a very simple USB driver that can be auto-loaded when the device is plugged in to a computer and then we can use the driver to return the date/time when the device asks for it (unless I'm misunderstanding something).
I am now looking through USB development docs like Michael Opdenacker's Linux USB drivers course, I tried the Linux USB Project which seems dead. Skimmed through Driver Development for Windows NT just to get an idea, however I am still not able to figure out if this is possible or not, and how hard it would be.
I'm a complete beginner at this and maybe this is something out of my skill level, but I would like to figure out if will I need weird hacks and workarounds or is there a much more straightforward way to do this?
There seems to be little information about it or I'm just searching the wrong places.
Any ideas/or pointers on either solving the original problem or the current one?
system time is not necessarily the general time i.e. the 'atomic' time you get from a NTP server
the most obvious solution is to use autorun, this is also possible on linux but normally autorun is blocked so the user explicitely has to activate it
https://askubuntu.com/questions/642511/how-to-autorun-files-and-scripts-in-ubuntu-when-inserting-a-usb-stick-like-autor
the linux command to get the time is date or hwclock or if the computer is connected to the net it may be possible to contact a NTP server (if the firewall does not block this)
then your autorun program has to send the data to the SC4-HSM. i do not know what USB classes the SC4-HSM implements if it implements CDC ACM (virtual COM port) this is easy:
Unable to sync computer time to Arduino via USB
(something like echo "T$(($(date +%s)+60*60*$TZ_adjust))" >/dev/tty.usbmodemfa131)
maybe it is possible to access system time over the USB drivers, i do not know this right now

How would one go about to measure differences in clock time on two different devices?

I'm currently in an early phase of developing a mobile app that depends heavily on timestamps.
A master device is connected to several client devices over wifi, and issues various commands to these. When the client devices receive commands, they need to mark the (relative) timestamp when the command is executed.
While all this is simple enough, I haven't come up with a solution for how to deal with clock differences. For example, the master device might have its clock at 12:01:01, while client A is on 12:01:02 and client B on 12:01:03. Mostly, I can expect these devices to be set to similar times, as they sync over NTP. However, the nature of my application requires ms precision, so therefore I would like to safeguard against discrepancies.
A short delay between issuing a command and executing the command is fine, however an incorrect timestamp of when that command was executed is not.
So far, I'm thinking of something along the line of having the master device ping each client device to determine transaction time, and then request the client to send their "local" time. Based on this, I can calculate what the time difference is between master and client. Once the time difference is know, the client can adapt its timestamps accordingly.
I am not very familiar with networking though, and I suspect that pinging a device is not a very reliable method of establishing transaction time, since a lot factors apply, and latency may change.
I assume that there are many real-world settings where such timing issues are important, and thus there should be solutions already. Does anyone know of any? Is it enough to simply divide response time by two?
Thanks!
One heads over to RFC 5905 for NTPv4 and learns from the folks who really have put their noodle to this problem and how to figure it out.
Or you simply make sure NTP is working properly on your servers so that you don't have this problem in the first place.

Resources