Home:ALL Converter>Run Cygwin script on shutdown or startup

Run Cygwin script on shutdown or startup

Ask Time:2016-07-15T11:29:00         Author:Jordan Elizaga

Json Formatter

I'm extremely new to Cygwin but I am somewhat comfortable in Linux (I can read man files fine).

I want to create a BASH script using Cygwin that deletes the files in a folder on the shutdown signal given by Windows. If this can't be done, I also could try deleting the files in the same folder on startup. I installed CRON but does CRON only works for scheduled tasks, rather than on 'signals'? Answers would be nice but a general idea of how to proceed would be even better!

I can write the script. I just don't know exactly how Cywgin interacts with the Windows OS in order to perform these procedures.

Another question, how do I run CRON on Windows startup?

If it matters, my O.S. is Windows 10 x64 running Cygwin.

Author:Jordan Elizaga,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38387419/run-cygwin-script-on-shutdown-or-startup
gzh :

Cygwin.bat, a batch file which was installed under cygwin installation folder will give you hint of how to run cygwin script.\n\nThe script contains just:\n\nC:\nchdir C:\\cygwin64\\bin\nbash --login -i\n\n\nto run the bash shell interactive.\nMake a copy of Cygwin.bat with another name (Startup ?) and change last line in\n\nbash --login path_to_your_script_here\n\n\nPut the bat file or a link to in in the Startup folder.",
2016-07-15T03:45:52
yy