Open ryanniehaus opened 8 years ago
@famewolf: This is implemented now
IN Readme it says if the temp dir is not specified it falls back on script dir. What if the output dir is specified? It could also be used for temp files. I would think it would fall back to output dir first and then script. Or do you have to do it as ./script /home/famewolf/vpn /home/famewolf/vpn ?
You would have to specify it as script /home/famewolf/vpn /home/famewolf/vpn That way you could specify the output directory and it could still use the script directory as a temp directory
I think I'll just stick with the hardcoded one I have. I have the script symbolically linked to /etc/cron.daily so it runs on a schedule...as far as the script would be concerned it's "working dir" would be /etc/cron.daily which is not somewhere I want it writing.
If you just repeat directories, it won't try to write in the cron folder. You'd just have to have a another script that calls this one with the arguments you'd need. Or would you rather it look for an environment variable?
No..I guess I had tunnel vision...I was so focused on the symbolic link to the script it never even occurred to me to do something simple like make a one line script to do the proper call. I'm sure there's an amusing acronym for that type of user error somewhere on the 'net. ;)
I tried simplifying things by having the script run directly on my freenas server which is also where the folder is shared from via smb but was unable to get the script to run correctly from the freebsd jail even after installing bash and the required tools. I'm currently playing around with freenas's virtualbox implementation and have created a ubuntu minimal VM...seems like a whole lot of work to try and have 1 machine keep 1 script updated. Maybe I need to rethink my approach...my end desire is to have the vpn folder sync'd to cloud storage so my android devices can pull in the folder with current user/pass since they can't run the script themselves.
Just tried new version...would still stick with old one. Where before each different vpn got it's own unique subfolder of www.vpnname.com now they all end up lumped into the same folder?
While I do like being able to specify the output folder so the script could be put into a /bin dir and the output could be kept in a vpn folder I still would want each vpn separated.
Yeah, I've started using OpenVPN on Windows, and I don't think it searches subdirectories. Maybe I'm mistaken.
The temp folder still has the subfolders. The output directory does not. However temp=output, you'll have both.
On Wed, Dec 30, 2015, 6:58 PM famewolf notifications@github.com wrote:
Just tried new version...would still stick with old one. Where before each different vpn got it's own unique subfolder of www.vpnname.com now they all end up lumped into the same folder?
— Reply to this email directly or view it on GitHub https://github.com/ryanniehaus/useful_scripts/issues/8#issuecomment-168101704 .
Do you get any errors in the script when running from Freebsd?
On Thu, Dec 31, 2015, 6:11 AM Ryan Niehaus ryan.niehaus@gmail.com wrote:
Yeah, I've started using OpenVPN on Windows, and I don't think it searches subdirectories. Maybe I'm mistaken.
The temp folder still has the subfolders. The output directory does not. However temp=output, you'll have both.
On Wed, Dec 30, 2015, 6:58 PM famewolf notifications@github.com wrote:
Just tried new version...would still stick with old one. Where before each different vpn got it's own unique subfolder of www.vpnname.com now they all end up lumped into the same folder?
— Reply to this email directly or view it on GitHub https://github.com/ryanniehaus/useful_scripts/issues/8#issuecomment-168101704 .
When I ran the script to test I didn't specify a path at all...I just let it default to the script dir for both temp and output and that's when it dumped everything in one dir.
Yeah when I ran it, it had some errors I corrected...for instance it wanted "iconv -c -s -f" as opposed to "iconv -csf " but even after fixing obvious errors it still was going wrong....on the old version that did create subdir's it was still writing everything to the script dir so something was failing with the "domain_url" part (going from memory).
Have you tried the latest version? The iconv -c -s -f change I made because cygwin iconv didn't like the iconv -csf simplification.
I'm wondering if you still have issues on freebsd with it. (I'd like to make my script compatible with as many platforms as possible)
I'll see about rebuilding the freebsd jail and try it again. I did finally get it working in a ubuntu minimal vm but the freebsd one would use far less resources. I wonder if freebsd has live usb images with persistence so you could install the necessary packages..would make testing easier.
One change would be changing the first line to " #!/usr/bin/env bash" as bash is in /bin for linux and /usr/local/bin for freebsd. Using the env version makes it work in both places as documented here: https://news.ycombinator.com/item?id=7596191 or use #!/bin/sh which is universal if bash is not specifically needed.
I've installed nano, bash, wget, and unix2dos to the shell...here is the output and it obviously goes south right from the beginning.
@famewolf: Some reason your version of sed doesn't find a match with my sed expression. I've broken it up into three separate sed commands to simplify the expression and still accomplish the same goal. Hopefully this just works. I'm not sure why your sed works so differently from mine.
Oh... it looks like there are still going to be issues with the zip file downloads. I see the zip file parsing isn't working either
Per Issue #1:
@famewolf made the following comment: "I guess the only addition I would request is a method to overwrite what directory to use as when ran from cron.daily it tries to put the zip files in the /etc/cron.daily dir.....I hardcoded the dir in the previous version."
I think this is a good idea, and should be done when I have time.