Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

Best way to test bash scripts?

Best way to test bash scripts?

edited August 2012 in General

So I've been working on a bash script that just sets up and configures servers for me, it's not too much different from the many already available but I'm doing it more for the learning aspect and the time savings when setting up new servers.

I currently have a dev VPS that I test this on, but it's becoming a pain in the ass to reload the OS, re-run the updated script and wait while it does everything again, only to find out I forgot a damn "\" in front of a "$" somewhere and repeat the process.

It's the whole reloading the OS and re-executing the script that is taking the most time. Even on a local VM, this is troublesome.

Just curious what you guys do when developing bash scripts.

vpsBoard.com - Now with over 450 members! A friendly community with active discussion. Come join us!

IRC.FREENODE.NET #vpsBoard - Drop by and say, 'Hello'.
Tagged:

Comments

  • Why not run it locally with VMWare Player or Virtual Box? On my PC and netbook I have 4 "clean" installs of Vyatta, CentOS, Arch Linux, and Fedora that I use for testing. If I need a Fedora install (Linux + GUI) then I'll just copy over the folder and use that copy to test with, then delete the copy.

    -Joe @ SecureDragon - LEB's Powered by Wyvern in FL, CO, CA, IL, NJ, GA, TX, and AZ
    Test our network here: Drgn.biz
  • I do use Virtual Box sometimes, but even then it can become a bit of a headache. I didn't know if those were the best options or if, I don't know, there was some other option available =]

    vpsBoard.com - Now with over 450 members! A friendly community with active discussion. Come join us!

    IRC.FREENODE.NET #vpsBoard - Drop by and say, 'Hello'.
  • I remember somebody telling me that they used some sort of setup where they mounted an image of the OS and after a reboot the OS went back to the image state and all charges were reverted. No idea how he did this but I do remember having similar software on the computers at my high school.

    -Joe @ SecureDragon - LEB's Powered by Wyvern in FL, CO, CA, IL, NJ, GA, TX, and AZ
    Test our network here: Drgn.biz
  • Hmm, I'll see what I can conjure up.

    On an un-related note, I sent you a PM a week or so ago, haven't heard back.

    vpsBoard.com - Now with over 450 members! A friendly community with active discussion. Come join us!

    IRC.FREENODE.NET #vpsBoard - Drop by and say, 'Hello'.
  • ZenZen Member
    edited August 2012

    Proxmox home server > backup fresh vm > restore instantly.

    Or...

    Make a reverse of your scripts functions which undoes everything? Just a thought.

    I work for Nodisto.

  • Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

    My Advice: : VPS Advice
  • @Zen said: Proxmox home server

    is very quick but no needs backups for clean fresh install, just drop it.

    Im out

  • @raindog308 said: Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

    exactly what i do with centmin mod.. virtualbox snapshot/restore saves alot of time :)

    Centmin Mod Project (ngx_pagespeed + SPDY support)
  • qjqqjq Member

    run the script bit by bit, line by line or keep editing the command and only append it to the bash script after you get it right

  • Proxmox... yiak. too much stuff to do before start.

    Vmware and snapshots is the coolest thing ever, but isn't free.

  • Take a snapshot of your stuff, break, restore, break again, repeat.

    VMware is awesome.

    -- BOFH

  • Debootstrap and Chroot.

    The Original Daniel.

  • karlkarl Member

    i have a private openvz node at my house, nothing powerful just a old c2d laptop that i use for testing scripts/setups so i don't have to touch anything thats in a live environment

  • Grab the ISO (centos etc) and fire up VMWare on your desktop

  • inverseinverse Member
    edited August 2012

    @raindog308 said: Virtualbox or similar is really what you want. You can create snapshots and rollback to them. As you make progress, create snapshots.

    +1 snap :)

Sign In or Register to comment.