Tech Support Forum banner
Status
Not open for further replies.
1 - 2 of 2 Posts

· Elite Commander
Veeam, HyperV, Vcentre, Server (2008 - 2022)
Joined
·
1,441 Posts
Discussion Starter · #1 ·
Hi All,
I know how to do this manually by performing the following command once I select the database:

insert log select * from adsb_aircraft;
delete from adsb_aircraft;

The database is called aircraft.

I need to ensure the id keeps incrementing hence the delete and not truncate.

sample data is -

+-----+--------+---------------------+---------------------+
| id | icao | firstSeen | lastSeen |
+-----+--------+---------------------+---------------------+
| 1 | 4ca1c2 | 2018-07-06 19:34:08 | 2018-07-08 22:26:16 |
| 2 | 406099 | 2018-07-06 19:34:23 | 2018-07-06 19:40:04 |
| 3 | 406605 | 2018-07-06 19:34:38 | 2018-07-08 19:15:32 |
| 4 | 40610f | 2018-07-06 19:35:38 | 2018-07-08 10:02:13 |
| 5 | 4006ee | 2018-07-06 19:35:54 | 2018-07-06 19:43:05 |
| 6 | 4d21a7 | 2018-07-06 19:37:09 | 2018-07-08 15:43:27 |
| 7 | 406d98 | 2018-07-06 19:38:56 | 2018-07-08 20:21:48 |
| 8 | 4ca80b | 2018-07-06 19:40:49 | 2018-07-06 19:48:07 |
| 9 | 40710e | 2018-07-06 19:42:20 | 2018-07-08 19:49:00 |
| 10 | 4069ea | 2018-07-06 19:44:21 | 2018-07-06 19:51:39 |


So basically I need to run the following command under a cron job at 00.01 each night:

insert log select * from adsb_aircraft;

and then at 00.02
delete from adsb_aircraft;

I wouldn't be expecting more than 1,000 rows per day so low volume.
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top