Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I generate a folder everyday consisting of different reports. I would like to compress these folders(named 0101207,01022017,etc etc) every six months. So folders named 01012017 to 06312017 would be compressed to a folder named 'Jan2017_Jun2017'. Then of course folders starting on 07012017 to 12312017 would be compressed in a folder named 'July2017_Dec2017. These folders are on a Windows shared folder. It would be ok for this automated tasks to be installed and ran from my laptop, but if it can be ran via CRON job that would be ok too, whichever is easier. Is this possible? Any help is highly appreciated
I'm not allowed to use this program, and it takes too long and I have to go through too much to get permission to run certain commands. I guess it would be better for it to run from my laptop.
@trickydba, unfortunately this is not a Windows forum.
Is Linux involved here at any point? You cited cron and then you said you can't use it due to Windows.
If you wish automated tools for Windows, then please seek an alternate forum on LQ such as the Non-Nix-General forum, or give Stack Overflow a try.
As far as Linux goes, people can offer some suggestions; however you need to cite your topology of systems, tell us where Linux is being used, or is capable of being installed, or allowed to be installed, and then people can offer some solutions here.
Well I just recently found out since creating this thread that I cannot create a cron job. I apologize. I guess at this point I would like to have a script that I can execute MANUALLY that can resolve my issue
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
Isn't this a political issue rather than a technical one?
If you're employed as a DBA and expected to back up then you need cron -- if your employer says otherwise get it in writing they don't want a backup and forget about it (whilst looking for a new job in case the imbeciles take the company down).
I understand.........still at this time I humbly ask for assistance with my issue. Is it possible in a script I can run every 6 months manually? I figure I can get the script 1st then request for the access to create a cron task. Either way, I would still need help
I generate a folder everyday consisting of different reports. I would like to compress these folders(named 0101207,01022017,etc etc) every six months. So folders named 01012017 to 06312017 would be compressed to a folder named 'Jan2017_Jun2017'. Then of course folders starting on 07012017 to 12312017 would be compressed in a folder named 'July2017_Dec2017. These folders are on a Windows shared folder. It would be ok for this automated tasks to be installed and ran from my laptop, but if it can be ran via CRON job that would be ok too, whichever is easier. Is this possible? Any help is highly appreciated
mite i suggest using better file names so that they sort better. something like year--month--date or year--day-of-year.
the script would probably call for things like tar:
I don't know if this is right but I wish it to be more dynamic in that maybe a requester pops up asking whether the save is for Jan to Jun or July to Dec. I came up with this code so far using Whiptail:
Code:
#!/bin/bash
OPTION=$(whiptail --title "Folder Compressor - By Me" --menu "Choose your date range to compress" 15 60 4 \
"1" "January to June" \
"2" "July to December" 3>&1 1>&2 2>&3)
exitstatus=$?
if [ $exitstatus = 0 ]; then
echo "Your chosen option:" $OPTION
else
echo "You chose Cancel."
fi
Now I would like for it to operate like this:
If I choose number 1, it will run my code(if it's right) and create the compressed filename 'JanJun2017', appending the year
If I choose number 2, it will run my code and create a compressed file 'JulyDecember2017' appending the year
showing a progress bar, then when done it shows "Compression successful!" and exits.
I know Whiptail has a 'gauge' function that displays a progress bar
I know this isn't the question asked but if I wanted to store data on a windows machine then I'd use windows folder compression tools to save data and make the information seamlessly available to all resources.
However many linux programs might be ran from limited user permissions. Tar and many other programs could be used and piped to some compression and some have switches that make renaming rather easy. Kind of the issue is how much permissions do you have in linux. Simple tar may not be allowed. You could even have some higher permissions that allow distro based programs to be run.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.