Crontab won't run from root

Hi,
I'm on 10.3.9 with a crontab issue.
It seems crontab won't run from root. The crontab is set to run a test script every hour, 00 * * * * /Users/station3/bashscripts/cronscript1
but it won't. I can run the script from the terminal while logged in as root just fine so i dont think it's a path to the script or permission. I get no errors either, it just doesnt run.
I can run the script from the crontab of an admin user just fine.
Any ideas?

I can see that yes, when i run cron it's in a
different environment, but which one?
It uses the root environment. When you use sudo -s, you're getting root privileges, but keeping your regular login environment. If you want to truly become "root" with all the , you'll need to use sudo su -. That'll give you root's environment.
The simplest way to add an environment variable to a crontab is to just stick it at the top of the crontab. I always add my email address to my crontabs:
MAILTO='[email protected]'That makes it easier to control where I get the email sent if there's output of some kind. You can also add the usual ".bashrc" and ".bash_profile" files to root's home directory at /var/root, but I'm not certain how to make cron see those without rebooting the computer. Read the bash man pages, particularly the invocation section for more information.
When I run it from the crontab, several, but not all
subfolders have had thier USER permissions changed to
"system" and I cannot access them.
How do I get around that?
Try using the -p switch with cp. That's alleged by the cp man page to preserve user ID, permissions, mod time, etc.
charlie

Similar Messages

  • Photo Album Won't Run From Internet

    CS4 - I posted earlier that my photo albums won't run from the internet but runs from my computer and from a flash drive. I have rebuilt it probably 10 times. The URL is http://www.kandjreynoldsconstruction.com/gallery/index.html. Albums that I've built before are still running. Any Help would be great. Donna

    Be sure that all the necessary supporting elements—javascripts, css, and images—have been uploaded to the server as well, using the same folder structure as the local version of your photo album. (Based on a look at the index page's source code, it seems that elements may be missing.)

  • Automator app won't run from double-click

    automator app won't run from double-click in finder or from alert from ical. Will only run if I open in automator editor.
    I found a solution on my own. I opened activity monitor and all the automator apps that I run daily were hanging up and the auromator launch was hanging up. I force quit them from the activity monitor. Now it works again.

    I might have gotten there eventually on my own, but I suspect finding your post saved me a lot of work. Thanks for posting your solution.

  • Any restriction on Mac that binaries running from root dirs like /usr/libexec/ cannot load dylib's at run-time?

    Hi all,
    Is there any restriction on Mac OS X 10.6/10.7 that binaries running from root directories like /usr/libexec/ cannot load dylib's at run-time using dlopen() or NSAddImage()?
    I am trying to run a binary like "sample" from a directory inside /usr/libexec/ which tries to load a dylib like "sample.dylib" which is present in the same directory as "sample".
    It resulted in a segmentation fault with the following error and stack-trace.
    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_INVALID_ADDRESS at address: 0x0000000000003430
    0x0000000000003430 in ?? ()
    Using gdb, I could find out that the program crashed inside dlopen() (the path passed to dlopen() being a simple filename like "sample.dylib").
    The dlopen() at the top of the stack-trace pasted below gets called around 10 times; it does not crash during this 2nd level dlopen() any-time.
    #0  0x00007fff81be9e93 in dlopen ()
    #1  0x00007fff82838f7f in map_images_nolock ()
    #2  0x00007fff82821bc0 in map_images ()
    #3  0x00007fff5fc039b9 in __dyld__ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_imag e_infoE ()
    #4  0x00007fff5fc0c839 in __dyld__ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE ()
    #5  0x00007fff5fc04d48 in __dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE ()
    #6  0x00007fff5fc08f68 in __dyld_dlopen ()
    #7  0x00007fff81be9ec0 in dlopen ()
    #8  0x000000010002694f in AAA ()
    #9  0x0000000100026730 in XXX ()
    #10 0x0000000100026494 in YYY ()
    #15 0x00000001000566a9 in main (argc=7, argv=0x7fff5fbff810) at ../../main.c:50
    After this 2nd level dlopen() gets called 10-15 times, the stack will unwind from map_images_nolock () till  __dyld_dlopen (). But when it tries to finish all the instructions inside  __dyld_dlopen () and step out of it, the program crashes with the EXC_BAD_ACCESS signal.
    Please find below the final stack-traces obtained during debugging when I put breakpoints for AAA() and dlopen() and went on stepping inside till the program crashed.
    (gdb) bt
    #0  0x00007fff5fc04d48 in __dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE ()
    #1  0x00007fff5fc08f68 in __dyld_dlopen ()
    #2  0x00007fff81be9ec0 in dlopen ()
    #3  0x000000010002694f in AAA ()
    #4  0x0000000100026730 in XXX ()
    #5  0x000000010002663c in YYY ()
    #11 0x00000001000566a9 in main (argc=7, argv=0x7fff5fbff7f0) at main.c:50
    (gdb) step
    Single stepping until exit from function __dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE,
    which has no line number information.
    0x00007fff5fc08f68 in __dyld_dlopen ()
    (gdb) bt
    #0  0x00007fff5fc08f68 in __dyld_dlopen ()
    #1  0x00007fff81be9ec0 in dlopen ()
    #2  0x000000010002694f in AAA ()
    #3  0x0000000100026730 in XXX ()
    #4  0x000000010002663c in YYY ()
    #10 0x00000001000566a9 in main (argc=7, argv=0x7fff5fbff7f0) at ../../main.c:50
    (gdb) step
    Single stepping until exit from function __dyld_dlopen,
    which has no line number information.
    Program received signal EXC_BAD_ACCESS, Could not access memory.
    Reason: KERN_INVALID_ADDRESS at address: 0x0000000000003430
    0x0000000000003430 in ?? ()
    To summarise:
    For some reason, a user wants to install a product and its binaries under /usr/libexec/.
    This binary tries to dynamically load a dylib using dlopen("sample.dylib", RTLD_LAZY | RTLD_LOCAL).
    It looks like, the dynamic linker then opens dependent dylibs and runs module initialisers. Then crashes when returning (which sounds like a trashed stack).
    Can anyone please tell me whether there is some OS-imposed restriction or OS bug which can explain this type of behaviour?
    (Note: The crash does not occur if the binary and dylib are installed under a normal user's home directory and run from there.)
    Many thanks,
    Vinay

    The otool output for the binary and dylib are pasted below.
    localhost:Latest dev$ otool -L /usr/libexec/Dipu/sample/sample
    /usr/libexec/Dipu/sample/sample:
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.18.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    localhost:Latest dev$ otool -L /usr/libexec/Dipu/sample/sample.dylib
    /usr/libexec/Dipu/sample/sample.dylib:
    libProduct.dylib (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 136.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.18.0)

  • Battery stopped charging; won't run from battery

    A couple of days ago, my computer stopped running from battery, and stopped charging the battery. I can see that the level is 67%, but that never goes up, and it shuts down if I unplug the power adapter.
    Here is XBattery info:
    Installed: Yes
    Charging: No
    Charger: Yes
    Battery%: 67
    Max. cap: 4.400Ah
    Curr. cap: 2.271Ah
    Charge: 1.534Ah
    Voltage: 11.850V
    Amperage: 0
    Cycles: 680
    Flags: 41000005
    Anyone know how I can fix this?

    I have the same issue with my Powerbook G4 15" Aluminum (battery not charging and clock not retaining date and time). A 3rd party warranty company is trying to say it's the rechargable battery but I think it's something to do wit hthe small battery located on a daughter board on the motherboard. Can anyone verify this or does this sound like a totally different issue?
    The battery was replaced under the recall less than a year ago.
    Thanks,
    Bob

  • Elements 6.0 won't run from my external hard drive?

    So I had Photoshop Elements 6.0 installed on my laptop. Long story short, my laptop died. I removed the hard drive, put it in a case and turned it into an external. When placed into another working laptop, Elements runs just fine. However, when I hook it up as an external, it refuses to run. Because I didn't make an icon for PSE on my desktop, I have to go into Program Files and under PSE 6.0 and find the application icon for it and double click. A message pops up saying "Licensing for this product has stopped working. - You cannot use this product at this time. You must repair the problem by uninstalling and then reinstalling this product or contacting your IT administrator or Adobe customer support for help."
    What gives?

    dj_paige wrote:
     If you take the hard drive and install it into a different computer and make this hard drive the system drive (i.e. the drive where the operating system is installed) then everything on that drive should work properly. If you take the hard drive and attach it to a computer that already has a system drive, nothing on that hard drive will work.
    Mr Ellis had a more lucid explanation of this, but I'll add a bit to both of your treatises, hopefully this will add clarity, but who knows, anything can happen.
    The >> BIOS << of a computer is responsible for the "boot order" of the machine. That is where the computer gets its instructions about where to look for the OS. If you summarily stuff a random HDD into a machine and expect it to boot from it, in most cases you will be disappointed. Since the drive didn't exist before, it likely won't appear first in the boot order, and gets ignored. So, to use any random HDD, you first would have to go into the BIOS and place it first in the boot order, then the computer would use the OS it found there to begin the session.
    The trouble is, Windows takes note of hardware changes, and might ask you to reactivate Windows, when it realizes it is no longer in the original computer. Obviously the original hardware manifest is on the HDD being transported, and would be dramatically different from the hardware environment of the new machine.
    In most cases, Windows will not perform up to expectations if it isn't reinstalled into the new host machine.
    However you can retrieve the catalog file from the laptop HDD and place it in the new computer, and also copy the "My Pictures" folder to it. Since, in this case both the laptop "My Pictures" and desktop "My Pictures" are both likely on their respective "C:/" drives, in all likelyhood PSE would be able to open the catalog successfully.
    I should add that in the case of running the OS from an external HDD, the first choice in the computer's boot order must be set to, "boot from USB device"!

  • G3 won't run from battery after display replacement

    The display on my ibook recently cratered. I bought a good used one and was able to replace it myself. The display now works fine but, the ibook will no longer run off the battery. If you unplug the adapter the computer instantly turns off. The approx 6 month old battery shows 0% percent charge and the ac adapter almost always glows orange. Or it shows the battery with an X and the adapter glows green. I tried an older battery and it will show 10% w/ constant glow of orange. From reading other posts this sounds like a DC board. But why after replacing the display? Did I forget to plug something in when putting it back together? I've performed the PCM reset w/ no luck.Thanks in advance.

    Hey actioncam 1,
    This is the official Apple line
    "The battery won't charge
    1. Remove any connected peripherals.
    2. Try known-good power outlet.
    3. Try known-good power adapter and power cord.
    4. Try known-good battery.
    5. Reset the power manager by pressing the key combination Control-Option-Shiftpower.
    Warning: Make sure you do not hold down the "fn" key when resetting the
    power manager.
    Warning: Resetting the power manager will permanently remove a RAM disk, if
    present, and all of its contents. You will also need to reset the date and time
    (using the Date & Time control panel).
    6. Replace logic board." (Right!)
    Now I just had this problem with a 12" iBook G3 500 that had been sitting for a while. It wouldn't boot and the battery was dead. Now I've had this happen before and I just let it sit for a while on the adapter and then it did boot.
    However it would not charge the battery and wouldn't take any of 5 extras I have around here, which were all dead.
    Additionally it would suddenly go to sleep like in a matter of seconds.
    (actually at second sight I should have reset the PMU at this point)
    I put in a fully charged battery from a G4 and it became completely normal, even to charging a dead battery. Go figure. But I've seen it before.
    Richard
    Message was edited by: spudnuty

  • FB4: Just migrated to Windows 7 and apps won't run from HTML

    I've got a new laptop with Windows 7 Pro 64-bit. I've installed FB4 and moved all my projects over to it. When I try to run an app from inside FB4 (using either Firefox or IE8), and it loads the HTML file, nothing happens. If I change the URL to point to the SWF file instead, hey presto it works.... I presume I need to change a security setting somewhere, but what and where?
    Thanks

    I wonder--what would happen if you launched FB4 as an administrator?  Right click on the icon and say "Run as administrator."
    Does it publish the file correctly when running as administrator?

  • Tecra 8100: updating bios from cd. exe won't run from command line

    I want to update the bios of my Tecra 8100.
    I downloaded the bios, but as the pc has no floppy, I cretaed a bootable cd like this
    When I boot the pc, do F2, press c to boot from cd, I get into a dos-like environment. I went to drive Z, did 'dir', and see the bios.exe I burned on cd. To run it I type bios.exe and keep getting "command of filename not recognized" when i type dir *.exe, it does not see the file either.
    Maybe I am overlooking something here?
    +Message was edited by: link removed - wrong info+

    Thank you.
    It was a different bios then on this page:
    I got there from [this|http://eu.computers.toshiba-europe.com/innovation/download_driver_details.jsp?service=EU&selCategory =8&selFamily=195&selSeries=24&selProduct=103&selSh ortMod=null&language=13&selOS=all&selType=4&yearup load=&monthupload=&dayupload=&useDate=null&mode=al lMachines&search=&action=search&macId=&country=all &selectedLanguage=13&type=4&page=1&ID=20831&OSI D=-1&driverLanguage=42 ] page
    The download contained a iso, so that was easy enough to do the update.<br /><br />
    Thank you very much.
    Laptop is fully functional again, better then it ever did on win98se.

  • XML Tag Name too long, won't run from a procedure

    I have a select statement that creates an xml file using the xmlelement syntax. When I run the select statement on its own it runs fine and the xml file is generated with no errors. I'm building a procedure that does a bunch of stuff, with the end product being the generated xml file. Everything in the procedure works great, until I add the xmlelement select statement. When I try to compile it I get an error message that one of the identifiers is too long (it is 40 characters). Is there something special I need to do to get this to run within a procedure with the given tag names? I can't change the names as they are set by another department.
    Thanks.

    Sorry about that, Mondays are painful...
    I'm not sure if you want the whole procedure, it is quite long, but here is the xml part. I am using TOAD, and when I right click and Compile I receive this error: PLS-00114: identifier 'PostalCodeOfPatientsCurrentResidenceKnownFlag FROM Admissions' too long
    The part that confuses me is why does it run fine when I run it on it's own, I get the expected XML file, but when I try to run it from a procedure it fails.
    SELECT sys_xmlgen(XMLELEMENT("MHR", XMLELEMENT("Control",      XMLELEMENT("DeliverySiteInstitutionNumber",a.institution_number),
                                                           XMLELEMENT("CreationTimestamp",sysdate),
                                                                               XMLELEMENT("DSSVersion",'NotSure'),
                                                                               XMLELEMENT("ResubmissionFlag",'1'),
                                                                               XMLELEMENT("SubmissionYear",a.REPORT_YR_AND_MNTH),
                                                                               XMLELEMENT("SubmissionPeriod",a.SUBMISSION_PERIOD)),
         XMLELEMENT("Stakeholders",XMLELEMENT("Stakeholder", XMLELEMENT("SubmissionType",'A'),
                                                                                                                  XMLELEMENT("ULI", a.ULI),
                                                                                              XMLELEMENT("Gender",'Male/Female/Unknown'),
                                                                     XMLELEMENT("BirthDate", XMLATTRIBUTES(a.BIRTH_DATE_TYPE,a.BIRTH_DATE)),
                                                                                                                  XMLELEMENT("ResidenceInformation",XMLELEMENT("ProvinceOfPatientsResidence",a.PROVINCE_OF_RESIDENCE),
                                                                                                                                      XMLELEMENT("PostalCodeOfPatientsCurrentResidenceKnownFlag",a.POSTALCODE_KNOWN_FLAG),
                                                                                                                                                          XMLELEMENT("PostalCodeOfPatientsCurrentResidence",a.POSTALCODE))
                        )).getClobVal() AS "result"
    FROM Admissions a
    Edited by: user11293056 on Jun 22, 2009 12:54 PM

  • MB won't run from battery after firmware 1.1 update

    I know this post is similar to many others on this forum, but I have scoured the other entries and can't find one with my exact problem (or a solution). Sorry if this is a repeat.
    My MB has worked fine since I bought it in July. After I installed the MacBook SMC Firmware Update v1.1, however, it randomly decided one day not to run off of the battery anymore. If I plug in the AC adapter, it will boot, run fine, and charge the battery (the menu indicates a 100% charge), but as soon as I unplug the AC adapter the entire system shuts off.
    The problem is that I am living in China through July. After working at Apple for nearly 4 years, I was wise enough to purchase AppleCare ... but I can't exactly just hop in the car and take the machine to an Apple Store. Is there a solution for me? Because I'm traveling throughout China, my machine is essentially useless if it has to be plugged in. I'm going to be very upset if an Apple-recommended firmware update rendered my machine unusable.
    All applications are up-to-date (OS 10.4.8, Build 8L2127, 2ghz Duo with 1gb RAM).
    MacBook   Mac OS X (10.4.8)  

    I have a the same problem, at the Apple genious bar a different battery did not work, so they sent my computer in to the subcontractors in Memphis. They kept it less than 10 hours and sent it back with a new battery. The new battery worked for about one month. The funny thing is I am not getting an x on my battery icon anymore. Coconut battery says it is a good battery and is fully charged. I calibrated the battery the first thing when I got the unit back. The system profiler says the battery is present and charged, if the battery should go down just from sitting still, the power adapter will recharge the battery. But, The computer will not run on the battery. If the power adapter is unplugged, which happens about 50 times a day because of the magnetic attachment, the machine turns off. I too developed the probem only after downloading the firmware update that apple said I needed. It is clear from these posts that there is a problem between the motherboard and the battery, and maybe a problem with the battery's calibration software. Judging from the varied responses users have gotten from Apple, and the complete silence about the problem on the Apple support site, it is also clear that Apple either doesn't know what the problem is and therefore can't fix it, or Apple is trying to turn a blind eye to the problem hoping it will go away. These posts have been viewed over 100,000 times, this is not a small problem!

  • Lion won't run from usb hard drive

    I downloaded Lion yesterday.  Took 7 hours, from 5:30pm to 12:30am.  I bought a new 500GB USB hard drive to load it on.  I had previously upgraded the SL OSX per instructions.  The Lion install went fine.  It told me to reformat the drive, which I did (to get rid of MS-DOS formatting).  The Lion installer recognized the drive and went through a 20 minute install.
    Upon restart, it defaulted to SL on my internal drive.  I went to Preferences/Startup Disk and clicked on the "Mac OSX 10.7 on 500G HD" and clicked Restart.  Again, it defaulted to my internal SL drive.
    I restarted the computer and held down the Option key to pick a boot drive.  When the window appeared, the external drive was not in the list, only the internal SL drive and the Windows partition for Parallels.
    Repeating the above gets the same results.
    I understand that the Lion installer is now gone and I can't install it again.
    What do I do now? 

    The new hard drive is a Hitachi Lifestudio and it has one of those annoying "disks" that pop up on the screen wanting you to install some "Lifestudio" app.  Erasing the disk and reformatting does not stop that message, so it must be in hardware.
    It is.  Return it for a refund and get the below.
    I ALWAYS build my own drive (takes 5 mins). More storage and less money.
    Use FireWire not USB.
    USB is packet oriented and data transfer is managed by the CPU, Firewire is a streaming protocol and data transfer is managed by the CPU only to initiate transfer, after that, Firewire handles the rest dropping CPU load to nearly 0%.
    Put the drive below, in the enclosure at the bottom. Note how the enclosure has a cooling fan, and that the drive is mounted on vibration mounts. I know of no other hard drive enclosure with those features.
    A hard drive has three enemies 1) Heat, 2) Vibration, 3) A Windows 7 installation.
    http://www.amazon.com/Western-Digital-Intellipower-Desktop-WD20EADS/dp/B001RB1TI S/ref=sr_1_1?ie=UTF8&s=electronics&qid=1258862242&sr=8-1
    http://www.cooldrives.com/ox93saiihadr.html

  • DV4 Battery Issue - Battery Charges; But Laptop Won't Run From Battery Power

    Greetings,
    I have a DV4, and let me tell you - I am so over this laptop. I have had it for over a year, and in that time, the backlight went out 6 months into owning it, the battery died just after the one year mark, and the webcam has been broken since I sent this computer back to HP to have the backlight issue resolved. I will never buy a new HP ever again.
    Now, the battery I have replaced in my laptop charges - but, when I unplug the laptop from the wall, the battery power does NOT switch over. I have had this battery a total of two weeks - it was working fine until last night.  Any ideas?
    Thanks!

    Hi, SoCal Cal. Take a good hard look at your battery contacts: both the ones on the battery itself and the "prongs" in the PB case that engage with the slotlike contacts on the battery. Are any of them significantly darkened/tarnished? Is there any debris or fluff on or in them? Clean out any foreign matter, then insert and remove the battery at least a dozen times in succession to see whether doing so will wear away any tarnish that may be impairing the necessary electrical connections. There's not really any easy, better way to clean the contacts, at least not the ones in the slots on the batttery itself. Then test again.
    It sounds to me as though not all of the battery contacts are making good contact — though some of them obviously are, at least some of the time. Perhaps "working" the contacts this way will improve matters.
    I really don't know what's going on with your machine; these are just shots in the dark.
    Message was edited by: eww

  • MB won't run from charged battery

    Hi,
    My MB has developed a problem in which it will only run when connected to the mains. The battery is fully charged but within a few seconds of removing the mains lead it all goes black. The MB is less than 2 years old and I have had no previous problems. I have copied the battery information (below)
    Battery Information:
    Model Information:
    Serial Number: DP-ASMB016-3752-26f9
    Manufacturer: DP
    Device name: ASMB016
    Pack Lot Code: 0002
    PCB Lot Code: 0000
    Firmware Version: 102a
    Hardware Revision: 0500
    Cell Revision: 0102
    Charge Information:
    Charge remaining (mAh): 4774
    Fully charged: Yes
    Charging: No
    Full charge capacity (mAh): 4775
    Health Information:
    Cycle count: 121
    Condition: Good
    Battery Installed: Yes
    Amperage (mA): 0
    Voltage (mV): 12567
    Any help will be very much appreciated!
    Thanks
    AlanMB

    From the information you have posted, there is no obvious reason why your battery should be failing or why your MacBook is not working unplugged.
    However, the first line of attack for any battery problem is to reset the SMC. Follow the instructions here:
    http://support.apple.com/kb/HT1411
    If that does not address your issue, you may need to call AppleCare or visit an Apple store.

  • Script won't run from the Desktop

    I have a bash script that says something ordinary:
    #!/bin/bash
    /Applications/synergy/synergys -f --config /Applications/synergy/synergy.conf
    exit 0
    It is associated with the Smultron editor and I want it to run in a terminal (or invisibly) when I click a desktop icon. Now it is just displayed by Smultron.
    When I try to change 'Open with:' to 'Terminal' it says 'you don't have privileges to change the application to this document only. Do you want to change all your Smultron.app doc.s to open with application 'Terminal.app'? I continue and ...nothing happens.
    ls -al synergys.sh gives
    -rwxr-xr-x@ 1 chrism admin 70 30 May 2008 synergyc.sh
    How do I get the ** script to run when clicked, please?

    I've never seen an erro like you getting about not being able to change the default app for just this file. try rebuilding your launch services database. run this in terminal
    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
    and try changing the default app again. you should certainly be able to assign terminal to open this file or all .sh files.

Maybe you are looking for