Bash:调用此脚本的符号链接的路径

时间:2015-08-24 03:17:49

标签: bash scripting symlink

我有以下情况:

  • 我的脚本路径为:-------- throw Exception java.lang.ClassCastException: com.test.B cannot be cast to com.test.A at com.test.ModelA.handle(ModelA.java:35) at com.test.ModelA.handle(ModelA.java:35) at com.test.AbstractModel.execute(AbstractRule.java:12) at com.test.AbstractModel.execute(AbstractRule.java:9) at com.test.modelChain.execute(modelChain.java:35) at com.test.BManager.process(BManager.java:66) at com.test.BManager.process(BManager.java:31) at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy41.process(Unknown Source) at -----AConfig.class-------------------------------------------------- @Configuration public class AConfig<T>{ @Autowired private Model<T> modelA; @Autowired private Model<T> modelB; @Bean public List<Model<T>> getAModelList(){ List<Model<T>> lists = new ArrayList<Model<T>>(); lists.add(modelA); return lists; } @Bean public List<Model<T>> getBModelList(){ List<Model<T>> lists = new ArrayList<Model<T>>(); lists.add(modelB); return lists; } } -----AManager.class-------------------------------------------- @Component public class AManager implements Manager<AA>{ @Autowired private ModelChain<AA> modelChain; @Resource(name="getAModelList") private List<Model<AA>> aModelList; public void process(){ modelChain.setModelList(aModelList); // process Logic to use aModelList } } -----BManager.class-------------------------------------------------- @Component public class BManager implements Manager<BB>{ @Autowired private ModelChain<BB> modelChain; @Resource(name="getBModelList") private List<Model<BB>> bModelList; public void process(){ modelChain.setModelList(bModelList); // process Logic to use bModelList } }
  • 我想在各个/usr/local/bin/rsnapshot.period目录中添加符号链接,例如/etc/cron.[period]/

我想让脚本查找符号链接的完整路径,然后拉出[句点]部分,这样我就可以将它提供给rsnapshot。

我可以做所有文字黑客攻击。我遇到的问题是从bash脚本中获取调用符号链接的路径。 /etc/cron.hourly/rsnapshot似乎指向$0

有更好的方法来获取此信息吗?

0 个答案:

没有答案