I'm using a Raspberry Pi to collect data (from USB-serial converter) and I'd like the recording files to be numbered in ascending order, to make it easy to find out which one is the latest when browsing the filesystem with SFTP.
Normally, I'd accomplish that by using the date and time in the filename. But Raspberry Pi has no non-volatile calendar. And using the fake-hwclock date would confuse people.
What's a simple way to create filenames in sequentially increasing order, across multiple boots?
EDIT: In case I was unclear, the network isn't present during data collection, only during data download. And there are expected to be multiple reboots before the network is available again. (Plus my university blocks NTP!, so getting date is non-trivial even when connected. But that's a completely separate problem.)
I haven't completed the filesaving script, but it's going to be along the lines of
stty -F /dev/mydevice 9600 cat /dev/mydevice > /data/recorded-N.txt
Does raspbian use systemd? I got quite annoyed on another linux system trying to start a data collection script on hotplug using udev, because udev killed the script, even when using nohup, etc. The workaround was to make udev start a systemd service.