SOLVED pkg info bash script wanted for iocage jail backup

theomolenaar

Dabbler
Joined
Jun 12, 2016
Messages
43
Hello. I have a bash script/cron job which exports an iocage jail to a backup folder. Is there a way to see what packages are installed (including version numbers) in this zip file? I know I can pkg info inside a running jail. Then manually copy this list to a txt file and save it but an automatic way of generating this file would be very nice.
Any tips on what command to use from a bash script?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,700
Do you mean from the host?

iocage exec <jailname> pkg info > /mnt/mounted/directory/file.txt
 

theomolenaar

Dabbler
Joined
Jun 12, 2016
Messages
43
Yes from the Cron Job List. Thanks for sharing your code. I adapted it and added date and time.
Code:
# example format: 2021-03-29T1816
iocage exec qbitvpn2 pkg info > /mnt/pool1/media/backups/qbitvpn2/pkginfo_$(date +"%FT%H%M").txt


Thanks again. This is exactly what I was looking for.
 
Top